fix: check slot before keepalive to prevent blocking REST call delaying signal pickup
This commit is contained in:
parent
e461dfb7a7
commit
faa88070e7
20
src/events.c
20
src/events.c
|
|
@ -277,7 +277,25 @@ void *event_executor_thread(void *arg) {
|
|||
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();
|
||||
if (last_keepalive_ms == 0 || now - last_keepalive_ms >= 30000) {
|
||||
executor_keepalive(exec);
|
||||
|
|
|
|||
Loading…
Reference in New Issue