diff --git a/src/controller/persist.c b/src/controller/persist.c index 85f50615..81c36ff6 100644 --- a/src/controller/persist.c +++ b/src/controller/persist.c @@ -993,7 +993,10 @@ int persist_job_hook_fun(int type, int situation, int detail, void* cls, va_list ap) { (void)type; - (void)situation; + /* Write to WAL only after the state change is complete. + * BEFORE_EVENT has a different va_list layout and must be ignored. */ + if (situation != HOOK_AFTER_EVENT) + return 0; persist_t* p = cls; uint32_t wal_type = detail_to_wal_type(detail); @@ -1065,7 +1068,8 @@ int persist_queue_hook_fun(int type, int situation, int detail, void* cls, va_list ap) { (void)type; - (void)situation; + if (situation != HOOK_AFTER_EVENT) + return 0; persist_t* p = cls; uint32_t wal_type = detail_to_wal_type(detail); @@ -1096,7 +1100,8 @@ int persist_worker_hook_fun(int type, int situation, int detail, void* cls, va_list ap) { (void)type; - (void)situation; + if (situation != HOOK_AFTER_EVENT) + return 0; persist_t* p = cls; uint32_t wal_type = detail_to_wal_type(detail);