Refactor logging in PrinterDatabase and PrinterManager, and streamline config saving in SocketClient
- Update logging in PrinterDatabase to correctly reference the printer state type. - Remove redundant call to stopWaiting() in PrinterManager for cleaner code execution. - Ensure config saving in SocketClient occurs unconditionally for improved reliability.
This commit is contained in:
parent
3ca730ecee
commit
e2600f8242
@ -147,7 +147,7 @@ export class PrinterDatabase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
`Updated printer: ${chalk.bold.white(this.printer.name)}, State: ${chalk.bold.white(formatState(this.printer.state.type))}${state?.progress ? ` (${state.progress})` : ""} (${online ? chalk.green("Online") : chalk.dim.white("Offline")})`,
|
`Updated printer: ${chalk.bold.white(this.printer.name)}, State: ${chalk.bold.white(formatState(state.type))}${state?.progress ? ` (${state.progress})` : ""} (${online ? chalk.green("Online") : chalk.dim.white("Offline")})`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return updatedPrinter;
|
return updatedPrinter;
|
||||||
|
|||||||
@ -63,9 +63,10 @@ export class PrinterManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await stopWaiting();
|
||||||
|
|
||||||
logger.debug("Printers added:", addedPrintersCount);
|
logger.debug("Printers added:", addedPrintersCount);
|
||||||
logger.debug("Printers removed:", removedPrintersCount);
|
logger.debug("Printers removed:", removedPrintersCount);
|
||||||
await stopWaiting();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await stopWaiting();
|
await stopWaiting();
|
||||||
logger.error("Failed to update printers:", error);
|
logger.error("Failed to update printers:", error);
|
||||||
|
|||||||
@ -221,9 +221,9 @@ export class SocketClient {
|
|||||||
this.id = this.host._id;
|
this.id = this.host._id;
|
||||||
|
|
||||||
config.host = { id: this.id, authCode: this.host.authCode };
|
config.host = { id: this.id, authCode: this.host.authCode };
|
||||||
if (logs) {
|
|
||||||
await saveConfig(config);
|
await saveConfig(config);
|
||||||
}
|
|
||||||
this.sendDeviceInfo();
|
this.sendDeviceInfo();
|
||||||
this.subscribeToObjectEvents();
|
this.subscribeToObjectEvents();
|
||||||
this.subscribeToObjectUpdates({ objectType: "host", _id: this.id });
|
this.subscribeToObjectUpdates({ objectType: "host", _id: this.id });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user