Commit 1586eab
committed
Fix check-then-act race condition
The semaphore is aquired after the conditions for fetching are already
evaluated. It means that multiple threads/runners can decide to fetch
simultaneously and then wait on the same semaphore, even though only one
fetch is needed. Therefore, fetch would happen more often than what is
specified in fetch times, and requests can be slow under load.
commit-id:a4cd58e61 parent b34454b commit 1586eab
1 file changed
+9
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
132 | 141 | | |
133 | 142 | | |
134 | 143 | | |
| |||
183 | 192 | | |
184 | 193 | | |
185 | 194 | | |
186 | | - | |
187 | 195 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| |||
0 commit comments