modernice/goes

Projection debounce wait cap

Closed this issue · 1 comments

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?).

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.

  • 5 seconds should be a reasonable default for most applications
  • doubling the timeout should effectively prevent the debounce from triggering more than twice
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