@@ -93419,9 +93419,7 @@ var cache = __nccwpck_require__(6878);
93419
93419
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
93420
93420
;// CONCATENATED MODULE: external "node:path"
93421
93421
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
93422
- ;// CONCATENATED MODULE: external "node:stream/promises"
93423
- const external_node_stream_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream/promises");
93424
- ;// CONCATENATED MODULE: ./node_modules/.pnpm/detsys-ts@https+++codeload.github.com+DeterminateSystems+detsys-ts+tar.gz+817e4d4123b6fb4eae5_xidqcuah7tnxkzkfyksdcuh3ni/node_modules/detsys-ts/dist/index.js
93422
+ ;// CONCATENATED MODULE: ./node_modules/.pnpm/detsys-ts@https+++codeload.github.com+DeterminateSystems+detsys-ts+tar.gz+65dd73c562ac60a0683_pugfuojoota6b26hy6vcd3ndou/node_modules/detsys-ts/dist/index.js
93425
93423
var __defProp = Object.defineProperty;
93426
93424
var __export = (target, all) => {
93427
93425
for (var name in all)
@@ -93895,7 +93893,7 @@ var ALLOWED_SUFFIXES = [
93895
93893
];
93896
93894
var DEFAULT_IDS_HOST = "https://install.determinate.systems";
93897
93895
var LOOKUP = process.env["IDS_LOOKUP"] ?? DEFAULT_LOOKUP;
93898
- var DEFAULT_TIMEOUT = 3e4 ;
93896
+ var DEFAULT_TIMEOUT = 1e4 ;
93899
93897
var IdsHost = class {
93900
93898
constructor(idsProjectName, diagnosticsSuffix, runtimeDiagnosticsUrl) {
93901
93899
this.idsProjectName = idsProjectName;
@@ -93910,7 +93908,7 @@ var IdsHost = class {
93910
93908
request: DEFAULT_TIMEOUT
93911
93909
},
93912
93910
retry: {
93913
- limit: ( await this.getUrlsByPreference()).length,
93911
+ limit: Math.max(( await this.getUrlsByPreference()).length, 3) ,
93914
93912
methods: ["GET", "HEAD"]
93915
93913
},
93916
93914
hooks: {
@@ -93920,7 +93918,7 @@ var IdsHost = class {
93920
93918
this.markCurrentHostBroken();
93921
93919
const nextUrl = await this.getRootUrl();
93922
93920
if (recordFailoverCallback !== void 0) {
93923
- recordFailoverCallback(prevUrl, nextUrl);
93921
+ recordFailoverCallback(error3, prevUrl, nextUrl);
93924
93922
}
93925
93923
core.info(
93926
93924
`Retrying after error ${error3.code}, retry #: ${retryCount}`
@@ -94306,8 +94304,8 @@ var STATE_KEY_NIX_NOT_FOUND = "detsys_action_nix_not_found";
94306
94304
var STATE_NOT_FOUND = "not-found";
94307
94305
var STATE_KEY_CROSS_PHASE_ID = "detsys_cross_phase_id";
94308
94306
var STATE_BACKTRACE_START_TIMESTAMP = "detsys_backtrace_start_timestamp";
94309
- var DIAGNOSTIC_ENDPOINT_TIMEOUT_MS = 3e4 ;
94310
- var CHECK_IN_ENDPOINT_TIMEOUT_MS = 5e3 ;
94307
+ var DIAGNOSTIC_ENDPOINT_TIMEOUT_MS = 1e4 ;
94308
+ var CHECK_IN_ENDPOINT_TIMEOUT_MS = 1e3 ;
94311
94309
var DetSysAction = class {
94312
94310
determineExecutionPhase() {
94313
94311
const currentPhase = core.getState(STATE_KEY_EXECUTION_PHASE);
@@ -94531,12 +94529,15 @@ var DetSysAction = class {
94531
94529
}
94532
94530
}
94533
94531
async getClient() {
94534
- return await this.idsHost.getGot((prevUrl, nextUrl) => {
94535
- this.recordEvent("ids-failover", {
94536
- previousUrl: prevUrl.toString(),
94537
- nextUrl: nextUrl.toString()
94538
- });
94539
- });
94532
+ return await this.idsHost.getGot(
94533
+ (incitingError, prevUrl, nextUrl) => {
94534
+ this.recordPlausibleTimeout(incitingError);
94535
+ this.recordEvent("ids-failover", {
94536
+ previousUrl: prevUrl.toString(),
94537
+ nextUrl: nextUrl.toString()
94538
+ });
94539
+ }
94540
+ );
94540
94541
}
94541
94542
async checkIn() {
94542
94543
const checkin = await this.requestCheckIn();
@@ -94620,12 +94621,27 @@ var DetSysAction = class {
94620
94621
}
94621
94622
}).json();
94622
94623
} catch (e) {
94624
+ this.recordPlausibleTimeout(e);
94623
94625
core.debug(`Error checking in: ${stringifyError2(e)}`);
94624
94626
this.idsHost.markCurrentHostBroken();
94625
94627
}
94626
94628
}
94627
94629
return void 0;
94628
94630
}
94631
+ recordPlausibleTimeout(e) {
94632
+ if (e instanceof TimeoutError && "timings" in e && "request" in e) {
94633
+ const reportContext = {
94634
+ url: e.request.requestUrl?.toString(),
94635
+ retry_count: e.request.retryCount
94636
+ };
94637
+ for (const [key, value] of Object.entries(e.timings.phases)) {
94638
+ if (Number.isFinite(value)) {
94639
+ reportContext[`timing_phase_${key}`] = value;
94640
+ }
94641
+ }
94642
+ this.recordEvent("timeout", reportContext);
94643
+ }
94644
+ }
94629
94645
/**
94630
94646
* Fetch an artifact, such as a tarball, from the location determined by the
94631
94647
* `source-*` inputs. If `source-binary` is specified, this will return a path
@@ -94669,13 +94685,9 @@ var DetSysAction = class {
94669
94685
`No match from the cache, re-fetching from the redirect: ${versionCheckup.url}`
94670
94686
);
94671
94687
const destFile = this.getTemporaryName();
94672
- const fetchStream = (await this.getClient()).stream(versionCheckup.url);
94673
- await (0,external_node_stream_promises_namespaceObject.pipeline)(
94674
- fetchStream,
94675
- (0,external_node_fs_namespaceObject.createWriteStream)(destFile, {
94676
- encoding: "binary",
94677
- mode: 493
94678
- })
94688
+ const fetchStream = await this.downloadFile(
94689
+ new URL(versionCheckup.url),
94690
+ destFile
94679
94691
);
94680
94692
if (fetchStream.response?.headers.etag) {
94681
94693
const v = fetchStream.response.headers.etag;
@@ -94686,6 +94698,9 @@ var DetSysAction = class {
94686
94698
}
94687
94699
}
94688
94700
return destFile;
94701
+ } catch (e) {
94702
+ this.recordPlausibleTimeout(e);
94703
+ throw e;
94689
94704
} finally {
94690
94705
core.endGroup();
94691
94706
}
@@ -94699,6 +94714,36 @@ var DetSysAction = class {
94699
94714
core.setFailed(`strict mode failure: ${msg}`);
94700
94715
}
94701
94716
}
94717
+ async downloadFile(url, destination) {
94718
+ const client = await this.getClient();
94719
+ return new Promise((resolve, reject) => {
94720
+ let writeStream;
94721
+ let failed = false;
94722
+ const retry = (stream) => {
94723
+ if (writeStream) {
94724
+ writeStream.destroy();
94725
+ }
94726
+ writeStream = (0,external_node_fs_namespaceObject.createWriteStream)(destination, {
94727
+ encoding: "binary",
94728
+ mode: 493
94729
+ });
94730
+ writeStream.once("error", (error3) => {
94731
+ failed = true;
94732
+ reject(error3);
94733
+ });
94734
+ writeStream.on("finish", () => {
94735
+ if (!failed) {
94736
+ resolve(stream);
94737
+ }
94738
+ });
94739
+ stream.once("retry", (_count, _error, createRetryStream) => {
94740
+ retry(createRetryStream());
94741
+ });
94742
+ stream.pipe(writeStream);
94743
+ };
94744
+ retry(client.stream(url));
94745
+ });
94746
+ }
94702
94747
async complete() {
94703
94748
this.recordEvent(`complete_${this.executionPhase}`);
94704
94749
await this.submitEvents();
@@ -94922,6 +94967,7 @@ var DetSysAction = class {
94922
94967
}
94923
94968
});
94924
94969
} catch (err) {
94970
+ this.recordPlausibleTimeout(err);
94925
94971
core.debug(
94926
94972
`Error submitting diagnostics event to ${diagnosticsUrl}: ${stringifyError2(err)}`
94927
94973
);
0 commit comments