Provisioner improvements

This commit is contained in:
Fedor Indutny 2025-04-23 09:14:30 -07:00 committed by GitHub
commit 4e8f02e6e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -458,7 +458,8 @@ export class Provisioner {
return; return;
} }
log.info(`Provisioner: socket closed, code=${code}, reason=${reason}`); const logId = `Provisioner.#handleClose(${index})`;
log.info(`${logId}: closed, code=${code}, reason=${reason}`);
// Is URL from the socket displayed as a QR code? // Is URL from the socket displayed as a QR code?
const isActive = index === this.#sockets.length - 1; const isActive = index === this.#sockets.length - 1;
@ -466,18 +467,20 @@ export class Provisioner {
// Graceful closure // Graceful closure
if (state === SocketState.Done) { if (state === SocketState.Done) {
log.info('Provisioner: socket closed gracefully'); log.info(`${logId}: closed gracefully`);
return; return;
} }
if (isActive) { if (isActive) {
log.info('Provisioner: active socket closed'); log.info(`${logId}: active socket closed`);
this.#notify({ this.#notify({
kind: kind:
state === SocketState.WaitingForUuid state === SocketState.WaitingForUuid
? EventKind.ConnectError ? EventKind.ConnectError
: EventKind.EnvelopeError, : EventKind.EnvelopeError,
error: new Error(`Socket closed, code=${code}, reason=${reason}`), error: new Error(
`Socket ${index} closed, code=${code}, reason=${reason}`
),
}); });
} }
} }