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

handleEvent to async to deal with increased firehose volume #81

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Bossett
Copy link
Contributor

@Bossett Bossett commented Feb 7, 2024

With the recent increase in firehose activity, the firehose subscription struggles to keep up in real time. This gets much worse if you are doing more than a simple string match on posts.

To boost throughput significantly, this PR no longer awaits handleEvent in the subscription. Possible side effect is that if the generator is intended to handle every post and can't do that in real time, this just increases load until failure; but I think risk is small (this is the approach I take in https://github.com/Bossett/bsky-feeds without ill effect).

Exception handling has been moved to handleEvent - leaving it in the subscription with this approach makes logging harder to parse.

Moving error handling to src/subscription, this will allow handleEvent to occur in parallel
Verifying getOpsByType within the function now that handleEvent is managed async
@aendra-rininsland
Copy link

This PR should really be merged, it has improved throughput on every project I've ported it to (3, at last count).

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.

None yet

2 participants