Commit 1f444ee
authored
fix(cache_pull.py): avoid data race (#179)
The `session.get` method is not thread safe. Use thread local to provide
each worker with its own session.
It does not allow to maximize connections reuse as we originally
intended, but, regardless, each thread will reuse persistent connections
whenever possible. Also, we process input sequentially over the inputs
and in parallel over threads, with batch submission and no pauses, so
it's probably ~equivalent to before.
Tests continue to WAI and do not require changes because the mocks mock
`requests.Session`.
Closes #1781 parent 1f2ec1f commit 1f444ee
1 file changed
+11
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
| |||
43 | 52 | | |
44 | 53 | | |
45 | 54 | | |
46 | | - | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| |||
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| |||
120 | 129 | | |
121 | 130 | | |
122 | 131 | | |
123 | | - | |
124 | 132 | | |
125 | 133 | | |
126 | 134 | | |
| |||
134 | 142 | | |
135 | 143 | | |
136 | 144 | | |
137 | | - | |
138 | | - | |
| 145 | + | |
139 | 146 | | |
140 | 147 | | |
141 | 148 | | |
| |||
0 commit comments