orchard/internal/controller/store
Fedor Korotkov f6b48b7c42
Change event prefix to preserve order under load (#89)
* Change event prefix to preserve order under load

When there are a lot of events streamed from a worker, it's possible to have two batches coming for the same timestamp (which is a timestamp of the event on the worker). This way the existing logic would mess up the order because `index` and the random number doesn't guarantee the order.

To fix this I've changed the format of the prefix for the event to include tro things:

1. Timestamp in nanoseconds of the injection time on the controller so two sequential batches will have guaranteed order unless they are processed within a nanosecond.
2. Made the `index` being fixed length with trailing zeros, so they are properly lexicographically sorted (`000001`, `000002`, ...).

* No need to disable linting
2023-06-05 17:01:12 +00:00
..
badger Change event prefix to preserve order under load (#89) 2023-06-05 17:01:12 +00:00
errors.go Refactored working with a storage (#20) 2023-02-08 19:36:30 -05:00
store.go Events Entity (#28) 2023-03-13 08:04:17 -04:00