@vzn/vx-cache 0.0.648 → 0.0.650
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/package.json +2 -2
- package/src/index.ts +19 -10
package/README.md
CHANGED
|
@@ -83,6 +83,9 @@ workflow would carry a token that writes nowhere the run reads. A job
|
|
|
83
83
|
uses a lent token over its own and never lends one on, nor any once
|
|
84
84
|
its remote is off for the run.
|
|
85
85
|
|
|
86
|
+
An upload answered with a 5xx or a 429 is sent again, three tries in
|
|
87
|
+
all: a PUT names its hash, so a second one stores the same bytes.
|
|
88
|
+
|
|
86
89
|
A refused token is said once and turns the remote off for the run; a
|
|
87
90
|
refused write (a job that reads only) turns off writes alone. Any other
|
|
88
91
|
refusal is a warning naming the server's own words, and the task reads
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx-cache",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.650",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "vxCache(): a vx cache plugin for a server that speaks the vx-cache protocol, such as @vzn/vx-cache-server.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"jose: the tests sign the CI tokens the server checks."
|
|
33
33
|
],
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@vzn/vx": "^0.0.
|
|
35
|
+
"@vzn/vx": "^0.0.650"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
package/src/index.ts
CHANGED
|
@@ -800,16 +800,25 @@ export class VxCacheLayer implements RemoteCacheLayer {
|
|
|
800
800
|
private async upload(item: { hash: string; body: Blob }): Promise<void | false> {
|
|
801
801
|
// Queued before the remote or its writes were turned off.
|
|
802
802
|
if (this.disabled || this.writesRefused) return false
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
803
|
+
// Sent again after a 5xx or a 429, up to three tries, as the token's ask:
|
|
804
|
+
// the server failing to read GitHub's keys once lost a DTE worker's entry
|
|
805
|
+
// (2026-10-29). A PUT names its hash, so a second one stores the same bytes.
|
|
806
|
+
for (let attempt = 1; ; attempt++) {
|
|
807
|
+
const res = await this.request(`/v1/artifacts/${item.hash}`, {
|
|
808
|
+
method: 'PUT',
|
|
809
|
+
body: item.body,
|
|
810
|
+
headers: { 'content-type': 'application/octet-stream' },
|
|
811
|
+
timeoutMs: this.config.uploadTimeoutMs,
|
|
812
|
+
write: true,
|
|
813
|
+
paced: true,
|
|
814
|
+
})
|
|
815
|
+
if (res === undefined) return false
|
|
816
|
+
if (res.ok) return
|
|
817
|
+
if ((res.status !== 429 && res.status < 500) || attempt === ASK_ATTEMPTS)
|
|
818
|
+
throw await refusal(res)
|
|
819
|
+
await res.body?.cancel()
|
|
820
|
+
await this.wait(1000 * attempt)
|
|
821
|
+
}
|
|
813
822
|
}
|
|
814
823
|
}
|
|
815
824
|
|