Skip to content
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

Debounce stream management ack requests #1062

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

singpolyma
Copy link
Contributor

So that they don't send after every stanza goes out but only when idle.

@singpolyma singpolyma requested a review from sonnyp January 22, 2025 19:00
Copy link
Member

@sonnyp sonnyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I messed it up with queueMicroTask sorry.

I'm ok with reintroducing this but I have a couple of questions

  1. Why 100ms ?
  2. What is the exact use case for this?
  3. Could it be covered by "hooking" to sendMany instead ?

Please add a test or we run into the risk of it breaking again

@singpolyma
Copy link
Contributor Author

singpolyma commented Jan 23, 2025 via email

@sonnyp
Copy link
Member

sonnyp commented Jan 24, 2025

It's honestly just my go-to subsecond value

It seems a bit low for this use case. Maybe 250ms? Any idea what others do?

My intention with queueMicroTask was to send <r> after each "tick"

So this would send a single <r:

xmpp.send(<foo/>)
xmpp.send(<foo/>)

but not

await xmpp.send(<foo/>)
await xmpp.send(<foo/>)

wdyt of this approach?

I often see r being sent before we even heard from the last one

This could also happen with a 100ms debounce. Should we cancel the timeout and reschedule when receiving a <a/>?

I dont think this is related to sendMany, an application may have mani
different parts all sending stanzas out quickly at once that can't or aren't
done with sendMany, especially iqs.

👍

@singpolyma
Copy link
Contributor Author

singpolyma commented Jan 24, 2025 via email

@singpolyma
Copy link
Contributor Author

Please add a test or we run into the risk of it breaking again

How would you suggest to test something timing-dependent like this?

@singpolyma singpolyma force-pushed the debounce-ack-request branch from 4aa691d to 0c79e92 Compare January 28, 2025 16:46
@singpolyma
Copy link
Contributor Author

Ok, figured out timer mocks and added a test

So that they don't send after every stanza goes out but only when idle.
@singpolyma singpolyma force-pushed the debounce-ack-request branch from 0c79e92 to 1283c54 Compare January 28, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants