-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in 2.0.5 -> 2.1.0: Getting Error: failed to open cache: timeout #478
Comments
I'm pretty sure this was introduced by #409. |
After some research, perhaps the pre-commit config Testing with this configuration the formatting was also faster. So seems relying on pre-commits parallelization slowed things down slightly. |
Using |
In this instance,
We could make the connection timeout for the db configurable. It's currently set to |
Is it worth discussing how to make parallel usage of treefmt work better? A couple ideas:
Both these ideas would create scenarios where parallel treefmt processes could end up doing duplicate work (i.e.: formatting the same file), but I'm pretty sure the use case described above is one where people are "intelligently" using treefmt in parallel (not giving the various treefmt incantations overlapping work). |
I don't know if parallel execution is a path we should go down 🤔 |
Describe the bug
I just tried to update to
2.1.0
from2.0.5
. But now I start gettingI get this issue every time I try to run
treefmt
via pre-commit hook, if I don't have any cache. I have not been able to reproduce it runningtreefmt
directly. It seems to be becausepre-commit
is batching calls totreefmt
and there is some issue running multipletreefmt
in parallel and accessing this database?Of course it is fixable with
--no-cache
. But would be nice if I could use the cache when it is available.To Reproduce
Steps to reproduce the behavior:
https://github.com/terlar/pre-commit-treefmt-bug.git
nix develop
rm -r ~/.cache/treefmt
pre-commit run --all-files
Expected behavior
Running without failing with a timeout. Perhaps retry? Or add possibility to extend timeout or find another clever solution to the problem.
System information
Linux
Additional context
Only happens together with
pre-commit
or potentially also if you batch treefmt calls in other ways. I triggered this error with 100 files on one machine, but had to bump it on another one to trigger it. So it could potentially be that you cannot reproduce this depending on your hardware.The text was updated successfully, but these errors were encountered: