Skip to content

Conversation

@johnjones4
Copy link

@johnjones4 johnjones4 commented Mar 13, 2025

Motivation

  • When using SlidingWindow, the processing callback function does not begin receiving events until one full window duration has passed
  • If the incoming channel closes before the time.Sleep has completed, the system will hang and not properly close its outgoing channel which can prevent graceful shutdown.
  • Additionally, this is cumbersome for long duration windows whereas removing the time.Sleep statement allows the system to begin processing almost immediately

Modifications

  • Removed time.Sleep
  • An alternative implementation is use something like time.After to implement the full window delay so that the main loop can start immediately and properly handle the closed channel without hanging.

Verify change

  • Make sure the change passes the CI checks.

@reugn
Copy link
Owner

reugn commented Mar 14, 2025

Hi @johnjones4, thanks for raising this issue. At the moment, the flow blocks until the first window is elapsed even if the upstream has closed. The standard behavior for the sliding window operator is to wait for the first full window period before emitting elements downstream. #165 introduces a configuration option for partial results, which might be helpful if you're dealing with larger window sizes. Would that solve the problem you're encountering?

@johnjones4
Copy link
Author

Yes love the configuration option approach. That would fit my needs. Thank you!

@reugn reugn closed this Mar 14, 2025
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.

2 participants