Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race condition when saving caches
In the previous code there was a potential race condition when two or more workflows checked the cache at the same time: 1. Workflow 1: cache miss; Workflow 2: cache miss 2. Workflow 1: install; Workflow 2: install 3. Workflow 1: save cache; Workflow 2: save cache <<< RACE CONDITION This resulted in the step failing with the following error: Error: reserveCache failed: Cache already exists. Scope: refs/heads/master, Key: <key>, Version: <...> It's a bug in the @actions/cache package and it's discussed in the following issue: actions/toolkit#537 The correct behaviour would be for Workflow 2 to simply drop its attempt to save the cache entry when this situation occurs. For now, this code uses a workaround to fix this issue which works by detecting and catchin the above error based on its error message.
- Loading branch information