mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
api: fixed busy-polling of worker
This commit is contained in:
parent
770e9c2f2c
commit
29f3b23eb3
1 changed files with 8 additions and 10 deletions
18
lib/api.cpp
18
lib/api.cpp
|
@ -88,16 +88,14 @@ void Api::worker()
|
|||
{
|
||||
logger->info("Started worker");
|
||||
|
||||
while (running) {
|
||||
/* Process pending requests */
|
||||
while (!pending.empty()) {
|
||||
Session *s = pending.pop();
|
||||
if (s) {
|
||||
/* Check that the session is still alive */
|
||||
auto it = std::find(sessions.begin(), sessions.end(), s);
|
||||
if (it != sessions.end())
|
||||
s->execute();
|
||||
}
|
||||
/* Process pending requests */
|
||||
while (!pending.empty() && running) {
|
||||
Session *s = pending.pop();
|
||||
if (s) {
|
||||
/* Check that the session is still alive */
|
||||
auto it = std::find(sessions.begin(), sessions.end(), s);
|
||||
if (it != sessions.end())
|
||||
s->execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue