diff --git a/src/publisher.c b/src/publisher.c index bf1d480..5b01c7c 100644 --- a/src/publisher.c +++ b/src/publisher.c @@ -102,12 +102,13 @@ int main(int argc, char *argv[]) { //----- Start logging printf("Logger started [client=%s,interval=%ds]\n", client, loginterval); while (!__stop) { - interval = INTERVAL(loginterval); - // Log current interval + // Wait for next queue to be available: queue_id = (queue_id + 1) >= MAX_QUEUES ? 0 : (queue_id + 1); // Busy wait: while (queues[queue_id].issending) { }; + // Get current interval + interval = INTERVAL(loginterval); // Write msg header: *queues[queue_id].msg = '\0'; sprintf(queues[queue_id].msg, "%s\n%s\n%s\n%ld\n", ZMQ_TOKEN, key, client,