Skip to content

Commit 0a940f8

Browse files
authored
Ignore saving cache errors (#6)
Parallel jobs sometimes fail with an error: "Unable to reserve cache with key ..., another job may be creating this cache." This patch makes it just a warning.
1 parent fb245fc commit 0a940f8

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,17 @@ jobs:
4141
else
4242
echo "Tarantool version is $T, as expected"
4343
fi
44+
45+
test-concurrency:
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
runs-on: [ubuntu-20.04, ubuntu-20.04, ubuntu-20.04]
50+
runs-on: ${{ matrix.runs-on }}
51+
steps:
52+
- uses: actions/checkout@v2
53+
- name: Setup Tarantool
54+
uses: ./
55+
with:
56+
tarantool-version: '1.10'
57+
cache-key: test-concurrency-${{ github.run_id }}

dist/main/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,8 +3472,14 @@ async function run_linux() {
34723472
await io.cp(f, dest);
34733473
}
34743474
}
3475-
await cache.saveCache([cache_dir], cache_key);
3476-
core.info(`Cache saved with key: ${cache_key}`);
3475+
try {
3476+
await cache.saveCache([cache_dir], cache_key);
3477+
core.info(`Cache saved with key: ${cache_key}`);
3478+
}
3479+
catch (error) {
3480+
core.warning(error.message);
3481+
core.warning(`Saving cache failed, but it's not crucial`);
3482+
}
34773483
await io.rmRF(cache_dir);
34783484
}
34793485
catch (error) {

src/main.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,14 @@ async function run_linux(): Promise<void> {
107107
}
108108
}
109109

110-
await cache.saveCache([cache_dir], cache_key)
111-
core.info(`Cache saved with key: ${cache_key}`)
110+
try {
111+
await cache.saveCache([cache_dir], cache_key)
112+
core.info(`Cache saved with key: ${cache_key}`)
113+
} catch (error) {
114+
core.warning(error.message)
115+
core.warning(`Saving cache failed, but it's not crucial`)
116+
}
117+
112118
await io.rmRF(cache_dir)
113119
} catch (error) {
114120
core.setFailed(error.message)

0 commit comments

Comments
 (0)