Commit 5666c91
Use WAL with SQLite cache, fix close (#21154)
This is the more modern way to manage concurrency with SQLite. Relevant
to current discussion, it means concurrent mypy runs using the cache
will wait for each other, rather than fail
SQLite also claims this is significantly faster, but I haven't yet done
a good profile (If you are profiling this, note that WAL is a persistent
setting, so you will want to delete the cache). This might also allow
removing the `PRAGMA synchronous=OFF`
Finally, I also explicitly close the connection in main. This is
relevant to this change, because it forces checkpointing of the WAL,
which keeps reads fast, reduces disk space and means the cache.db
remains a single self-contained file under regular use
Fixes #21136, see also discussion in #13916
For what it's worth, I feel there are many legitimate uses of concurrent
mypy. At work, we often share cache between multiple projects. At home,
I often end up having parallel runs with a debugger while working on
mypy (although this PR just makes those ones hang waiting for the lock
lol)
---------
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>1 parent 949ccd0 commit 5666c91
2 files changed
+14
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
192 | 198 | | |
193 | 199 | | |
194 | 200 | | |
195 | 201 | | |
196 | 202 | | |
197 | 203 | | |
198 | 204 | | |
199 | | - | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
227 | 233 | | |
228 | 234 | | |
229 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
230 | 240 | | |
231 | | - | |
| 241 | + | |
232 | 242 | | |
233 | 243 | | |
234 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| 175 | + | |
174 | 176 | | |
175 | | - | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
0 commit comments