Skip to content

Commit

Permalink
Extra debug information
Browse files Browse the repository at this point in the history
  • Loading branch information
jfberry committed Nov 27, 2023
1 parent bb062c5 commit 8bc85e6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,25 @@ wssScanner.on('connection', (ws, req) => {
const firstSpareWorkerId = nextSpareWorkerId;
do {
const mainDeviceId = identifyControlChannelFromWorkerId(nextSpareWorkerId);
log.info(`SCANNER: Found ${mainDeviceId} connects to workerId ${nextSpareWorkerId}`)

Check failure on line 225 in packages/server/src/index.ts

View workflow job for this annotation

GitHub Actions / Nx Cloud - Main Job / Run

Insert `;`
if (mainDeviceId == null) {
log.info(`SCANNER: Warning - found ${nextSpareWorkerId} in pool with no record of main device`);
unallocatedConnections.push(nextSpareWorkerId);
nextSpareWorkerId = unallocatedConnections.shift() as string;
} else {
const mainDeviceInfo = deviceInformation[mainDeviceId];
if (mainDeviceInfo.lastScannerConnection + config.monitor.deviceCooldown > Date.now() / 1000) {
// device was allocated to someone else too recently, find another
if (!mainDeviceInfo) {
log.info(`SCANNER: Warning - found ${nextSpareWorkerId} in pool with no record of main device ${mainDeviceId}`);
unallocatedConnections.push(nextSpareWorkerId);
nextSpareWorkerId = unallocatedConnections.shift() as string;
} else {
eligibleDeviceFound = true;
if (mainDeviceInfo.lastScannerConnection + config.monitor.deviceCooldown > Date.now() / 1000) {
// device was allocated to someone else too recently, find another
unallocatedConnections.push(nextSpareWorkerId);
nextSpareWorkerId = unallocatedConnections.shift() as string;
} else {
eligibleDeviceFound = true;
}
}
}
} while (!eligibleDeviceFound && nextSpareWorkerId != firstSpareWorkerId);
Expand Down

0 comments on commit 8bc85e6

Please sign in to comment.