mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-05 01:00:48 +00:00
Merge pull request #2408 from balena-os/fix-socket-timeout
Ensure poll socket timeout is defined early
This commit is contained in:
commit
175872b358
@ -3,6 +3,7 @@ import url from 'url';
|
|||||||
import { setTimeout } from 'timers/promises';
|
import { setTimeout } from 'timers/promises';
|
||||||
import Bluebird from 'bluebird';
|
import Bluebird from 'bluebird';
|
||||||
import type StrictEventEmitter from 'strict-event-emitter-types';
|
import type StrictEventEmitter from 'strict-event-emitter-types';
|
||||||
|
import { Agent } from 'https';
|
||||||
|
|
||||||
import type { TargetState } from '../types/state';
|
import type { TargetState } from '../types/state';
|
||||||
import { InternalInconsistencyError } from '../lib/errors';
|
import { InternalInconsistencyError } from '../lib/errors';
|
||||||
@ -120,6 +121,13 @@ export const update = async (
|
|||||||
const got = await getGotInstance();
|
const got = await getGotInstance();
|
||||||
|
|
||||||
const { statusCode, headers, body } = await got(endpoint, {
|
const { statusCode, headers, body } = await got(endpoint, {
|
||||||
|
retry: { limit: 0 },
|
||||||
|
agent: {
|
||||||
|
https: new Agent({
|
||||||
|
keepAlive: true,
|
||||||
|
timeout: apiRequestTimeout,
|
||||||
|
}),
|
||||||
|
},
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${deviceApiKey}`,
|
Authorization: `Bearer ${deviceApiKey}`,
|
||||||
'If-None-Match': cache?.etag,
|
'If-None-Match': cache?.etag,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user