Use WAL with SQLite cache, fix close by hauntsaninja · Pull Request #21154 · python/mypy
This is the more modern way to manage concurrency with SQLite In our case, it means concurrent mypy runs using the cache will wait for each other, rather than fail SQLite also claims this is 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) Finally, I also explicitly close the connection in main. This is relevant to this change, because it forces checkpointing of the WAL, which reduces disk space and means the cache.db remains a single self-contained file in regular use