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

refactor: send larger messages properly #455

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

sangelovic
Copy link
Collaborator

@sangelovic sangelovic commented Sep 17, 2024

Until now, the solution to ensure that even large messages are fully sent out has been to flush the connection queues after each sending of a message, which is likely an unnecessary call (with unnecessary cost) in vast majority of cases, and which may block the connection from doing other work until the large message is fully sent out. This was a rather quick, hacky workaround.

Now, after the sending the message we check whether it has been sent out fully or not. If not (outbound queues are non-empty), then we send a wake-up signal to the connection event loop. The event loop thread then fetches new sd-bus timeouts and events and will see that there are pending outbound messages to process, and will process them together with any other prospective pending events, until there is nothing to process (i.e., the outbound message has been fully dispatched).

@sangelovic sangelovic force-pushed the refactor/sending-large-messages branch from 72f024f to bf36142 Compare September 17, 2024 13:30
@sangelovic sangelovic force-pushed the refactor/sending-large-messages branch 2 times, most recently from bc52746 to 3498fe6 Compare October 9, 2024 16:47
@sangelovic sangelovic force-pushed the refactor/sending-large-messages branch from 3498fe6 to 73666a3 Compare October 9, 2024 16:53
@sangelovic sangelovic requested a review from Oxymoron79 October 10, 2024 14:09
@sangelovic sangelovic merged commit 1c4b755 into master Oct 10, 2024
6 checks passed
@sangelovic sangelovic deleted the refactor/sending-large-messages branch October 10, 2024 14:10
sangelovic added a commit that referenced this pull request Oct 10, 2024
Until now, the solution to ensure that even large messages are fully sent out has been to flush the connection queues after each sending of a message, which is likely an unnecessary call (with unnecessary cost) in vast majority of cases, and which may block the connection from doing other work until the large message is fully sent out. This was a rather quick, hacky workaround.

Now, after the sending the message we check whether it has been sent out fully or not. If not (outbound queues are non-empty), then we send a wake-up signal to the connection event loop. The event loop thread then fetches new sd-bus timeouts and events and will see that there are pending outbound messages to process, and will process them together with any other prospective pending events, until there is nothing to process (i.e., the outbound message has been fully dispatched).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant