Commit 845d36e
committed
Handle concurrent inserts in PostgreSQL when enqueuing recurring tasks
Very similar to inserting recurring tasks on boot.
PostgreSQL fails and aborts the current transaction when it hits
a duplicate key conflict during two concurrent INSERTs for the same
value of an unique index. We need to use `insert` instead of `create`
here and indicate unique_by to ignore duplicate rows by this value
when inserting1 parent d1676d5 commit 845d36e
1 file changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
10 | 25 | | |
11 | 26 | | |
12 | 27 | | |
13 | 28 | | |
14 | | - | |
| 29 | + | |
15 | 30 | | |
16 | 31 | | |
17 | 32 | | |
18 | | - | |
19 | | - | |
20 | 33 | | |
21 | 34 | | |
22 | 35 | | |
| |||
0 commit comments