Commit d71aa8a
committed
Stop retrying semaphore decrement when getting a deadlock
This was added in d72fe46 and initially,
it seemed like a good idea, but it ended up causing a different error
as it messed with Active Record's transactions. The error would be
```
ActiveRecord::StatementInvalid (Mysql2::Error: SAVEPOINT active_record_1 does not exist)
```
And this made us realise it might be more complicated, because we might be
in a transaction that wraps the Solid Queue transaction.
Since this is such an edge case that happens only with certain job loads
and perhaps only with MySQL, InnoDB and READ COMMITTED, let's stop trying to
be too clever about it, and instead, simplify this a bit by avoiding the
decrement at all when the semaphore's limit is 1 and it was just created.1 parent 5b8577d commit d71aa8a
1 file changed
+5
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
65 | 62 | | |
66 | 63 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | 64 | | |
82 | 65 | | |
83 | 66 | | |
| |||
0 commit comments