Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
There are a couple of things that could be re-written or modified in the current event handling code:
- The name EventCache is a bit of a misnomer. This is the entry point of the whole event mechanism, not a cache. Suggested new name is EventSystem.
- The cache and publisher are created separately. The publisher does not work without the remaining infrastructure. They should be handled together. In a similar vein, starting the publisher with a separate start() method should be hidden.
- Get rid of extra interfaces: during the design phase, the intention was having multiple implementations. However, we still have only one (shimPublisher, defaultEventStore). As long as we don't have mocks and multiple implementations, let's remove it to reduce code.
- We need to guard against the condition if the event cache is "nil" (disabled). But we end up having code like:
eventCache := events.GetEventCache(); eventCache != nil { ... send event ... }
An extra layer eg. ApplicationEvents.sendEventNotFit() enhances readability and usability.
- Nit: use atomic.Bool instead of atomic.Value in shimPublisher.
Attachments
Issue Links
- links to