Commit Graph

6 Commits

Author SHA1 Message Date
Alessandro (Ale) Segala 2d30434d91
Update linter to 1.55.1 and fix linter errors (#71)
* Update linter to 1.55.1 and fix linter errors

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Also disable tagalign linter

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

---------

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
2023-10-30 11:55:29 -07:00
Josh van Leeuwen 4f434ebc3f
Adds events/ratelimiting/coalescing (#64)
* Adds events/ratelimiting/coalecing

events/ratelimiting is a new utility package to provides helpers which
can be used to rate limit events.

Coalecing is a new helper that will exponentially rate limit events. It
will coalesce events into a single event if they occur within the same
rate limiting window. Coalesce also has the option to forcibly fire an
event when the number of events reaches a certain threshold. Added to
prevent events from never being fired in a high throughput scenario.

Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: Josh van Leeuwen <me@joshvanl.dev>
Signed-off-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
2023-10-25 13:15:16 -07:00
Alessandro (Ale) Segala 50fac882cf
events: make "WithClock" methods allowed without "unit" build tag (#62)
There are use cases where having those methods available even outside of a unit test is helpful, such as when the objects are instantiated with a clock that could be mocked in the unit test for the parent method.

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
2023-09-13 14:59:34 -07:00
Josh van Leeuwen f08dc3ff16
Use correct package name in queue/processor_unit.go (#61)
Signed-off-by: joshvanl <me@joshvanl.dev>
2023-09-07 09:50:49 -07:00
Josh van Leeuwen c007625dc6
Always wait in close, Speed up eventqueue tests & don't pass clock (#59)
* Don't pass clock to processor, and speed up tests

Signed-off-by: joshvanl <me@joshvanl.dev>

* Review comments

Signed-off-by: joshvanl <me@joshvanl.dev>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2023-08-28 17:31:14 -07:00
Josh van Leeuwen 569cc87ddb
Adds batcher utility (#58)
* Adds batcher utility

Signed-off-by: joshvanl <me@joshvanl.dev>

* Add `WithClock` for testing

Signed-off-by: joshvanl <me@joshvanl.dev>

* Renamees eventqueue to queue, and move queue and batcher under events

Signed-off-by: joshvanl <me@joshvanl.dev>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2023-08-14 13:04:38 -07:00