Commit 02be96c
authored
feat(core): throttle PostgreSQL event listener notifications (Vibe Kanban) (#40)
* Done. Now with `throttleTime(100, asyncScheduler, { leading: true, trailing: true })`:
| Events arrive at | Poll triggered at |
|------------------|-------------------|
| 0ms | 0ms (leading) |
| 10ms | - |
| 20ms | - |
| 50ms | - |
| 80ms | 100ms (trailing) |
If more events arrive after the 100ms window closes, the cycle repeats - first one fires immediately, then trailing fires after another 100ms if there were more.
The 100ms value is a reasonable default. Want me to make it configurable via `OutboxModuleOptions`?
* Done. Now configurable via `eventListenerThrottleMs`:
```typescript
OutboxModule.forRoot({
events: [...],
pollingInterval: 5000,
maxEventsPerPoll: 100,
driverFactory: mikroOrmDriverFactory,
eventListenerThrottleMs: 50, // optional, defaults to 100ms
})
```1 parent b12a5a8 commit 02be96c
2 files changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
0 commit comments