Skip to content

Prevent concurrent cache access#135

Merged
rtimush merged 2 commits into
masterfrom
cache-lock
May 21, 2024
Merged

Prevent concurrent cache access#135
rtimush merged 2 commits into
masterfrom
cache-lock

Conversation

@rtimush
Copy link
Copy Markdown
Collaborator

@rtimush rtimush commented May 21, 2024

libgit2 fails if we try to access the same cached repository concurrently. This is however very likely to happen when multiple projects in cargo workspace use protofetch to fetch from the same source.

This PR makes protofetch acquire a lock on the cache directory before accessing it, so only one instance can work with the cache at a time. The lock is not granular, but it should be good enough.

@rtimush rtimush requested a review from a team May 21, 2024 15:19
@coralogix coralogix deleted a comment from kolov May 21, 2024
@rtimush rtimush merged commit ae3a9fd into master May 21, 2024
@rtimush rtimush deleted the cache-lock branch May 21, 2024 16:34
@rtimush rtimush mentioned this pull request May 22, 2024
rtimush added a commit that referenced this pull request May 22, 2024
## 🤖 New release
* `protofetch`: 0.1.3 -> 0.1.4

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

##
[0.1.4](v0.1.3...v0.1.4)
- 2024-05-22

### Other
- Prevent concurrent cache access
([#135](#135))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants