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

fix: correctly set batching mode during pubsub #937

Merged
merged 1 commit into from
Mar 14, 2023
Merged

Conversation

romange
Copy link
Collaborator

@romange romange commented Mar 13, 2023

Previously we set batch mode when dispatch queue is not empty but dispatch queue could contain other async messages related to pubsub or monitor. Now we enable batching only if there are more pipeline commands in the queue.

Fixes #935.

@romange romange requested a review from dranikpg March 13, 2023 19:28
Previously we set batch mode when dispatch queue is not empty
but dispatch queue could contain other async messages related to pubsub or monitor.
Now we enable batching only if there are more pipeline commands in the queue.

In addition, fix the issue of unlimited aggregation of batching buffer.

Fixes #935.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
@romange romange force-pushed the FixPubsubPipeline branch from 1b9b286 to 793092d Compare March 13, 2023 19:30
Comment on lines +55 to +61
if (total_size < 8192) { // Allow batching with up to 8K of data.
for (unsigned i = 0; i < len; ++i) {
std::string_view src((char*)v[i].iov_base, v[i].iov_len);
DVLOG(2) << "Appending to stream " << src;
batch_.append(src.data(), src.size());
}
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd maybe move this magic number to a constant somewhere

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do in the next pr

@romange romange merged commit 66b4fbd into main Mar 14, 2023
@romange romange deleted the FixPubsubPipeline branch March 14, 2023 11:01
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.

Connection drop on QUIT when busy
2 participants