Implement host ID check in device state update method
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Added a validation check in the `setDevicesState` method to ensure the host ID is present before proceeding with the device state update. - Introduced a warning log to notify when the host ID is not found, preventing unnecessary operations.
This commit is contained in:
parent
cd12a0ca0d
commit
dc285a63fe
@ -266,6 +266,11 @@ export class SocketHost {
|
||||
async setDevicesState(state, online, connectedAt) {
|
||||
logger.info('Setting devices state to', state, 'and online to', online);
|
||||
|
||||
if (!this.host._id) {
|
||||
logger.warn('Host not found. Skipping device state update.');
|
||||
return;
|
||||
}
|
||||
|
||||
const documentPrinters = await listObjects({
|
||||
model: getModelByName('documentPrinter'),
|
||||
filter: { host: this.host._id }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user