This repository was archived by the owner on Feb 16, 2026. It is now read-only.
fix: deplete read session wait budget on retry#293
Merged
infiniteregrets merged 6 commits intomainfrom Feb 6, 2026
Merged
Conversation
Greptile OverviewGreptile Summary
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant ReadSession as read_session()
participant Retry as can_retry()/RetryBackoff
participant Inner as session_inner()
participant Client as BasinClient.read_session()
participant Net as Stream (batches.next())
Caller->>ReadSession: read_session(client, name, start, end)
Note over ReadSession: baseline_wait = end.wait
Note over ReadSession: start_time = Instant::now()
loop Create initial session (with retries)
ReadSession->>ReadSession: end.wait = remaining_wait(baseline_wait, start_time)
ReadSession->>Inner: session_inner(client, name, start, end)
Inner->>Client: read_session(name, start, end)
Client-->>Inner: batches stream
Inner->>Net: timeout(20s, batches.next())
alt heartbeat timeout / retryable error
Inner-->>ReadSession: Err(ReadSessionError)
ReadSession->>Retry: can_retry(err)
alt retry
Retry-->>ReadSession: sleep(backoff)
else no retry
Retry-->>ReadSession: false
ReadSession-->>Caller: return Err
end
else ok
Inner-->>ReadSession: Ok(stream)
end
end
ReadSession-->>Caller: Streaming<ReadBatch>
loop Consume stream
Caller->>ReadSession: next()
ReadSession->>Inner: (underlying stream) timeout(20s, batches.next())
alt stream item ok
Inner-->>ReadSession: Ok(batch)
ReadSession-->>Caller: Ok(batch)
else stream item err
Inner-->>ReadSession: Err(err)
Note over ReadSession: batches = None
ReadSession->>Retry: can_retry(err)
alt retry
Retry-->>ReadSession: sleep(backoff)
ReadSession->>ReadSession: end.wait = remaining_wait(baseline_wait, start_time)
ReadSession->>Inner: session_inner(...)
else no retry
ReadSession-->>Caller: Err(err)
end
else stream ends
Inner-->>ReadSession: None
ReadSession-->>Caller: None
end
end
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.