Skip to content

Commit 0ede4ee

Browse files
committed
timeout fetch plus log messages
Signed-off-by: Jeromy Cannon <[email protected]>
1 parent abdabc2 commit 0ede4ee

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/commands/node.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ export class NodeCommand extends BaseCommand {
582582
throw new FullstackTestingError(`failed to create port forward for '${nodeId}' proxy on port ${localPort}`, e)
583583
}
584584
}
585-
localPort++
586585
}
587586

588587
throw new FullstackTestingError(`proxy for '${nodeId}' is not UP [ attempt = ${attempts}/${maxAttempts}`)
@@ -885,8 +884,10 @@ export class NodeCommand extends BaseCommand {
885884

886885
async getNodeProxyStatus (url) {
887886
try {
887+
this.logger.debug(`Fetching proxy status from: ${url}`)
888888
const res = await fetch(url, {
889889
method: 'GET',
890+
signal: AbortSignal.timeout(5000),
890891
headers: {
891892
Authorization: `Basic ${Buffer.from(
892893
`${constants.NODE_PROXY_USER_ID}:${constants.NODE_PROXY_PASSWORD}`).toString(
@@ -896,9 +897,12 @@ export class NodeCommand extends BaseCommand {
896897
const response = await res.json()
897898

898899
if (res.status === 200) {
899-
return response[0]?.stats?.filter(
900+
const status = response[0]?.stats?.filter(
900901
(stat) => stat.name === 'http_backend')[0]?.stats?.status
902+
this.logger.debug(`Proxy status: ${status}`)
903+
return status
901904
} else {
905+
this.logger.debug(`Proxy request status code: ${res.status}`)
902906
return null
903907
}
904908
} catch (e) {

src/core/k8.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ export class K8 {
672672

673673
// add info for logging
674674
server.info = `${podName}:${podPort} -> ${constants.LOCAL_HOST}:${localPort}`
675+
this.logger.debug(`Starting port-forwarder [${server.info}]`)
675676
return server.listen(localPort, constants.LOCAL_HOST)
676677
}
677678

0 commit comments

Comments
 (0)