Skip to content

Commit

Permalink
Ignore closed communicators in queue
Browse files Browse the repository at this point in the history
  • Loading branch information
trikko committed Apr 30, 2024
1 parent 2da125d commit 8159f4e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions source/serverino/daemon.d
Original file line number Diff line number Diff line change
Expand Up @@ -696,16 +696,22 @@ package:
{
auto communicator = Communicator.popFromWaitingList();

communicator.setWorker(availableWorkers.front);
availableWorkers.popFront;
if(communicator.requestToProcess !is null)
{
communicator.setWorker(availableWorkers.front);
availableWorkers.popFront;
}
}
else if(!deadWorkers.empty)
{
auto communicator = Communicator.popFromWaitingList();

deadWorkers.front.reinit(true);
communicator.setWorker(deadWorkers.front);
deadWorkers.popFront;
if(communicator.requestToProcess !is null)
{
deadWorkers.front.reinit(true);
communicator.setWorker(deadWorkers.front);
deadWorkers.popFront;
}
}
else break; // All workers are busy. We'll try again later.
}
Expand Down

0 comments on commit 8159f4e

Please sign in to comment.