Commit e3adee4
fix(eventing): make inbox idempotent, use no-op mail in integration tests
Root cause: all 68 integration tests pass, but the process hangs during
shutdown because:
1. EfCoreInboxStore.MarkProcessedAsync did a blind INSERT, causing
PK_InboxMessages duplicate key violations when the same event was
processed via both the direct publish and outbox retry paths concurrently.
This caused outbox messages to never be marked as processed, leading to
infinite retry loops.
2. UserRegisteredEmailHandler tried to send real emails in CI (no SMTP
configured), failing with "Rate limited". Hangfire retried these jobs
with exponential backoff (10 retries), keeping the process alive past
the CI timeout.
Fixes:
- Make MarkProcessedAsync idempotent: check HasProcessedAsync before INSERT,
and catch DbUpdateException for the concurrent race case
- Register a NoOpMailService in the test factory to prevent real SMTP calls
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f8a4c39 commit e3adee4
3 files changed
Lines changed: 40 additions & 2 deletions
File tree
- src
- BuildingBlocks/Eventing/Inbox
- Tests/Integration.Tests/Infrastructure
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
30 | 40 | | |
31 | 41 | | |
32 | 42 | | |
| |||
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
39 | | - | |
40 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
41 | 60 | | |
42 | 61 | | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments