Commit Graph

5 Commits

Author SHA1 Message Date
Josh van Leeuwen 77af8ac182
events/loop & slices (#119)
* events/loop & slices

Adds a generic control loop implementation to `event/loop`.

Adds a new `slices` package that provides a generic slice de-duplication
func.

Makes events batcher and queue processer taker in Options.

Allows enqueuing multiple processor items in same func call.

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

* Lint

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

* lint

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

* lint

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

* Elements match

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

* Adds buffer size option to events loop

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

* nit

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

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2025-04-23 11:28:21 -03:00
Josh van Leeuwen 6c3b2ee1ef
Events: type Batcher value & ensure queue order (#89)
* Events: type Batcher value & ensure queue order

Update Batcher to allow for typed value types.

Update Batcher and Queue to execute values in order they were added.

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

* Delay batcher to ensure key is sent in order

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

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2024-03-26 13:31:51 +02:00
Josh van Leeuwen 858719eb78
Change `events/batcher` to use `events/queue` as backend. (#82)
* events/batcher: use events/queue as queue backend

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

* Make events/queue/queue key type comparable

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

* Explicitly define NewProcessor generic type in test

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

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2024-01-15 09:08:33 -08:00
Josh van Leeuwen df64d3a144
Update fswatcher to use /events/batcher (#75)
* Update fswatcher to use /events/batcher

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

* Linting

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

* Linting

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

* Add sleep to wait for windows fsnotify to become ready

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

* Increase time for event to be received to 1 second

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

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2023-11-15 16:36:20 -08:00
Alessandro (Ale) Segala 5a284d0d92
Bring in fswatcher from runtime (#26)
* Bring in fswatcher from dapr/dapr

Also improved batching and error handling, and added unit tests

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

* Fixed resetting batchCh and added test

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

* Added missing copyright header

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

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
2022-10-31 11:04:07 -07:00