1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/test/fixtures
Thomas Heartman d60e505a40
1-1049 Emit events after db transaction is complete (#4174)
This PR fixes an issue where events generated during a db transaction
would get published before the transaction was complete. This caused
errors in some of our services that expected the data to be stored
before the transaction had been commited. Refer to [linear issue
1-1049](https://linear.app/unleash/issue/1-1049/event-emitter-should-emit-events-after-db-transaction-is-commited-not)
for more info.

Fixes 1-1049.

## Changes

The most important change here is that the `eventStore` no longer emits
events when they happen (because that can be in the middle of a
transaction). Instead, events are stored with a new `announced` column.
The new event announcer service runs on a schedule (every second) and
publishes any new events that have not been published.

Parts of the code have largely been lifted from the
`client-application-store`, which uses a similar logic.

I have kept the emitting of the event within the event store because a
lot of other services listen to events from this store, so removing that
would require a large rewrite. It's something we could look into down
the line, but it seems like too much of a change to do right now.

## Discussion

### Terminology:

Published vs announced? We should settle on one or the other. Announced
is consistent with the client-application store, but published sounds
more fitting for events.

### Publishing and marking events as published

The current implementation fetches all events that haven't been marked
as announced, sets them as announced, and then emits them. It's possible
that Unleash would crash in the interim or something else might happen,
causing the events not to get published. Maybe it would make sense to
just fetch the events and only mark them as published after the
announcement? On the other hand, that might get us into other problems.
Any thoughts on this would be much appreciated.
2023-07-10 08:43:22 +02:00
..
access-service-mock.ts feat: custom root roles (#3975) 2023-06-14 14:40:40 +01:00
fake-access-store.ts fix: fetching user root roles include custom ones (#4068) 2023-06-22 14:42:01 +00:00
fake-account-store.ts fix: add confirmation to disable password login (#3829) 2023-05-23 15:56:34 +01:00
fake-addon-store.ts OpenAPI: addon operations (#3421) 2023-04-18 10:50:34 +00:00
fake-api-token-store.ts Feat/add alias to api tokens (#1931) 2022-08-19 10:48:33 +02:00
fake-client-applications-store.ts refactor: replace ts-ignore with ts-expect-error (#1675) 2022-06-07 11:49:17 +02:00
fake-client-instance-store.ts Remove timeout from store (#3018) 2023-01-30 12:01:44 +01:00
fake-client-metrics-store-v2.ts feat: remove old metrics service 2021-12-10 09:31:54 +01:00
fake-context-field-store.ts Feat/stats service (#2211) 2022-10-25 13:10:27 +02:00
fake-environment-store.ts feat: add max order to environments (#3988) 2023-06-15 12:21:35 +03:00
fake-event-store.ts 1-1049 Emit events after db transaction is complete (#4174) 2023-07-10 08:43:22 +02:00
fake-favorite-features-store.ts Favorite features (#2550) 2022-11-29 16:06:08 +01:00
fake-favorite-projects-store.ts Favorite project (#2569) 2022-11-30 13:41:53 +02:00
fake-feature-environment-store.ts feat: add warning hints on potential misconfiguration (#2948) 2023-01-20 18:09:01 +01:00
fake-feature-strategies-store.ts feat: add instance stats to version check (#3835) 2023-06-13 15:54:20 +02:00
fake-feature-tag-store.ts feat: export by tags (#3635) 2023-04-27 10:22:14 +02:00
fake-feature-toggle-client-store.ts bug(#3545): include strategy titles on playground evaluation results (#4084) 2023-06-29 10:38:51 +02:00
fake-feature-toggle-store.ts feat: save memory on reading stats (#3472) 2023-04-06 15:34:08 +02:00
fake-feature-type-store.ts refactor: add OpenAPI schema to feature types controller (#1684) 2022-06-09 13:17:13 +02:00
fake-group-store.ts fix: creating groups should work without users (#4033) 2023-06-21 14:44:43 +03:00
fake-pat-store.ts fix: limit total of PATs a user can have (#2301) 2022-11-02 08:11:35 +00:00
fake-project-stats-store.ts refactor: Improved lead time calculation (#3475) 2023-04-07 13:31:27 +02:00
fake-project-store.ts Feat: project default strategy (#3644) 2023-04-28 14:59:04 +03:00
fake-public-signup-store.ts Feat/invite user (#2061) 2022-09-30 13:01:32 +02:00
fake-reset-token-store.ts fix: Stores as typescript and with interfaces. (#902) 2021-08-12 15:04:37 +02:00
fake-role-store.ts fix: fetching user root roles include custom ones (#4068) 2023-06-22 14:42:01 +00:00
fake-segment-store.ts Feat/stats service (#2211) 2022-10-25 13:10:27 +02:00
fake-session-store.ts fix: Stores as typescript and with interfaces. (#902) 2021-08-12 15:04:37 +02:00
fake-setting-store.ts feat: Disable password based login (#1046) 2021-10-29 10:25:42 +02:00
fake-strategies-store.ts fixes 2-456: Preserve all data from strategy import (#2720) 2022-12-21 13:33:41 +01:00
fake-tag-store.ts fix: Stores as typescript and with interfaces. (#902) 2021-08-12 15:04:37 +02:00
fake-tag-type-store.ts fix: Stores as typescript and with interfaces. (#902) 2021-08-12 15:04:37 +02:00
fake-user-feedback-store.ts fix: Stores as typescript and with interfaces. (#902) 2021-08-12 15:04:37 +02:00
fake-user-splash-store.ts refactor: add schemas to user admin controller (#1692) 2022-06-22 14:55:43 +02:00
fake-user-store.ts feat: adapt user logic to better adapt to SAs (#2917) 2023-01-18 12:12:44 +00:00
no-logger.ts fix: Stores as typescript and with interfaces. (#902) 2021-08-12 15:04:37 +02:00
permissions.ts fix: convert files to typescript 2021-09-14 19:30:11 +02:00
store.ts feat: oss import (#3123) 2023-02-16 08:08:51 +01:00