modernice / goes

goes is an event-sourcing framework for Go.
https://goes.modernice.dev
Apache License 2.0
134 stars 12 forks source link

Projection debounce wait cap #42

Closed bounoable closed 2 years ago

bounoable commented 2 years ago

Problem

Currently, the Debounce(time.Duration) option of the continuous schedule has no cap on the total wait time before a projection job is triggered. Application that continuously publish a lot of events could cause infinite buffering of projection events.

Proposal

Add a DebounceCap(time.Duration) option that specifies the wait cap. Use a sensible duration as the default (5s maybe?).

bounoable commented 2 years ago

Defaults

Heuristics completely pulled out of thin air: fixed cap of 5s if the debounce timeout is <= 2.5s, for higher timeouts simply double the timeout.

Debounce Default Cap
none none
100ms 5s
200ms 5s
500ms 5s
1s 5s
2s 5s
2.5s 5s
3s 6s
4s 8s
5s 10s
10s 20s
30s 1m
1m 2m
1.5m 3m
2m 4m
5m 10m