Skip to content

Commit c33ec6c

Browse files
committed
hail mary
1 parent 7f2d4ea commit c33ec6c

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

packages/@aws-cdk/toolkit-lib/lib/api/notices/web-data-source.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ export class WebsiteNoticeDataSource implements NoticeDataSource {
9292
timer.unref();
9393

9494
try {
95-
req = https.get(this.url,
95+
req = https.get(
96+
this.url,
9697
options,
9798
res => {
9899
if (res.statusCode === 200) {
@@ -118,7 +119,8 @@ export class WebsiteNoticeDataSource implements NoticeDataSource {
118119
} else {
119120
reject(new ToolkitError(`${humanHttpStatusError(res.statusCode!)} (Status code: ${res.statusCode})`));
120121
}
121-
});
122+
},
123+
);
122124
req.on('error', e => {
123125
reject(ToolkitError.withCause(humanNetworkError(e), e));
124126
});

packages/@aws-cdk/toolkit-lib/lib/util/network-detector.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as https from 'node:https';
2+
import type { RequestOptions } from 'node:https';
23
import * as path from 'path';
34
import * as fs from 'fs-extra';
45
import { cdkCacheDir } from './';
@@ -45,7 +46,7 @@ export class NetworkDetector {
4546
}
4647
}
4748

48-
private static readonly TIMEOUT_MS = 500;
49+
// private static readonly TIMEOUT_MS = 500;
4950
private static readonly URL = 'https://cli.cdk.dev-tools.aws.dev/notices.json';
5051

5152
private static async load(): Promise<CachedConnectivity> {
@@ -73,15 +74,20 @@ export class NetworkDetector {
7374
}
7475

7576
private static ping(agent?: https.Agent): Promise<boolean> {
76-
return new Promise((resolve) => {
77-
const req = https.request(NetworkDetector.URL, {
78-
method: 'HEAD',
79-
agent,
80-
timeout: this.TIMEOUT_MS,
81-
}, (res) => {
82-
resolve(res.statusCode !== undefined && res.statusCode < 500);
83-
});
77+
const options: RequestOptions = {
78+
// method: 'HEAD',
79+
agent: agent,
80+
// timeout: this.TIMEOUT_MS,
81+
};
8482

83+
return new Promise((resolve) => {
84+
const req = https.request(
85+
NetworkDetector.URL,
86+
options,
87+
(res) => {
88+
resolve(res.statusCode !== undefined && res.statusCode < 500);
89+
},
90+
);
8591
req.on('error', () => resolve(false));
8692
req.on('timeout', () => {
8793
req.destroy();

0 commit comments

Comments
 (0)