-
Notifications
You must be signed in to change notification settings - Fork 4
feat: filter for ping events #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 648f827 in 2 minutes and 27 seconds
More details
- Looked at
91
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. src/index.extras.ts:454
- Draft comment:
Reset pingTimeoutError on receiving a ping to clear previous timeout state. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
This comment is purely informative, explaining what a piece of code does. It doesn't provide a suggestion, ask for confirmation, or point out a potential issue.
2. src/index.extras.ts:71
- Draft comment:
Typo detected in the S2ClientConfig type definition: 'appedRetryPolicy' should likely be renamed to 'appendRetryPolicy' for clarity and consistency. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. src/index.extras.ts:135
- Draft comment:
Typographical error in the S2Account class: the property 'accountURLSuffx' should be corrected to 'accountURLSuffix' for improved readability. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. src/index.extras.ts:239
- Draft comment:
Typographical error in the S2Basin class: the property 'basinURLSuffx' should likely be renamed to 'basinURLSuffix' for consistency and clarity. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_aufrX3Waux95n4Wz
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
if (pingTimeoutError) throw pingTimeoutError; | ||
|
||
if (event.event === 'ping') { | ||
lastPingTime = Date.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When handling a 'ping' event, reset the timeout error. Consider adding pingTimeoutError = null;
after updating lastPingTime
to clear any previous error.
lastPingTime = Date.now(); | |
lastPingTime = Date.now(); pingTimeoutError = null; |
const PING_TIMEOUT_MS = 30000; | ||
let lastPingTime = Date.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should just be lastMessageTime
(so also reset it on data). And timeout can be 20s to be consistent with other SDKs.
@@ -433,33 +444,47 @@ class Stream { | |||
); | |||
stream = response as EventStream<ReadResponse>; | |||
if (!stream) return; | |||
|
|||
pingInterval = setInterval(checkPingTimeout, 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be set much more accurately rather than waking up every second
Important
Adds ping event handling and timeout detection in
Stream.readStream()
to ensure connection health.Stream.readStream()
to updatelastPingTime
on 'ping' events.PING_TIMEOUT_MS
constant andcheckPingTimeout
function to detect ping timeouts.pingInterval
on stream closure or error inStream.readStream()
.pingTimeoutError
if detected during stream processing.pingInterval
to periodically check for ping timeouts inStream.readStream()
.This description was created by
for 648f827. It will automatically update as commits are pushed.