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

Coalesce transform - implement true flush_when_millis_since_last_flush #1673

Open
rukai opened this issue Jun 21, 2024 · 0 comments
Open

Coalesce transform - implement true flush_when_millis_since_last_flush #1673

rukai opened this issue Jun 21, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@rukai
Copy link
Member

rukai commented Jun 21, 2024

Previously shotover's design did not allow for a true implementation of flush_when_millis_since_last_flush.
There was no way for the transform to trigger a flush all on its own, it had to wait for a new request to come in before the flush could be triggered.

This results in easily triggered poor behavior, for example:

  • flush_when_millis_since_last_flush set to 1000 (1 second)
  • client sends 1 request
  • 1 hour passes and no more requests are sent
  • flush never occurs and request is just stuck in shotover.

However shotover now supports this kind of functionality via force_run_chain.
So we should reimplement the flush_when_millis_since_last_flush logic of Coalesce to setup a tokio task in the background that will trigger a flush after the time has passed.

This should be done by:

  • setting up the task in CoalesceConfig::get_builder
  • the task runs a tokio::sleep(Duration::from_millis(flush_when_millis_since_last_flush)).await in a loop.
    • whenever the sleep elapses: trigger force_run_chain and send a message to the transform instance to let it know it needs to flush.
  • every time a flush occurs send the task a message to tell it to restart its timer
@rukai rukai added bug Something isn't working good first issue Good for newcomers labels Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant