Merge pull request #2408 from balena-os/fix-socket-timeout

Ensure poll socket timeout is defined early
This commit is contained in:
flowzone-app[bot] 2025-03-12 14:49:34 +00:00 committed by GitHub
commit 175872b358
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@ import url from 'url';
import { setTimeout } from 'timers/promises';
import Bluebird from 'bluebird';
import type StrictEventEmitter from 'strict-event-emitter-types';
import { Agent } from 'https';
import type { TargetState } from '../types/state';
import { InternalInconsistencyError } from '../lib/errors';
@ -120,6 +121,13 @@ export const update = async (
const got = await getGotInstance();
const { statusCode, headers, body } = await got(endpoint, {
retry: { limit: 0 },
agent: {
https: new Agent({
keepAlive: true,
timeout: apiRequestTimeout,
}),
},
headers: {
Authorization: `Bearer ${deviceApiKey}`,
'If-None-Match': cache?.etag,