fix: check slot before keepalive to prevent blocking REST call delaying signal pickup

This commit is contained in:
nicolas 2026-05-29 00:00:23 -03:00
parent e461dfb7a7
commit faa88070e7
1 changed files with 19 additions and 1 deletions

View File

@ -277,7 +277,25 @@ void *event_executor_thread(void *arg) {
if (read(fill_wake_fd, &val, sizeof(val)) < 0) {} if (read(fill_wake_fd, &val, sizeof(val)) < 0) {}
} }
/* Keepalive */ /* Check slot BEFORE keepalive — signal takes priority */
if (atomic_load_explicit(&slot->state, memory_order_acquire) == EXECUTOR_SLOT_READY) {
signal_entry_t sig = slot->signal;
atomic_store_explicit(&slot->state, EXECUTOR_SLOT_IN_FLIGHT, memory_order_release);
executor_execute_triangle(exec, &sig);
atomic_store_explicit(&slot->state, EXECUTOR_SLOT_FREE, memory_order_release);
/* Keepalive after execution (if still idle) */
int64_t now = now_mono_ms();
if (last_keepalive_ms == 0 || now - last_keepalive_ms >= 30000) {
executor_keepalive(exec);
last_keepalive_ms = now_mono_ms();
}
continue;
}
/* Keepalive only if slot is not ready */
int64_t now = now_mono_ms(); int64_t now = now_mono_ms();
if (last_keepalive_ms == 0 || now - last_keepalive_ms >= 30000) { if (last_keepalive_ms == 0 || now - last_keepalive_ms >= 30000) {
executor_keepalive(exec); executor_keepalive(exec);