Skip to content

Commit 84a1640

Browse files
committed
Fixed reserve future never getting notified
1 parent e1f5e89 commit 84a1640

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core-c-bridge/src/worker.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,14 +1059,16 @@ pub extern "C" fn temporal_core_complete_async_reserve(
10591059
let permit_id =
10601060
NonZero::new(permit_id).expect("permit_id cannot be 0 on successful reservation");
10611061
let prev_state = unsafe {
1062+
// Not turning completion_ctx into Arc yet as we only want to deallocate it on success
10621063
(*completion_ctx).state.compare_exchange(
10631064
SlotReserveOperationState::Pending,
10641065
SlotReserveOperationState::Completed(permit_id),
10651066
)
10661067
};
10671068
match prev_state {
10681069
Ok(_) => {
1069-
drop(unsafe { Arc::from_raw(completion_ctx) });
1070+
let completion_ctx = unsafe { Arc::from_raw(completion_ctx) };
1071+
completion_ctx.notify.notify_one();
10701072
true
10711073
}
10721074
Err(SlotReserveOperationState::Cancelled) => false,

0 commit comments

Comments
 (0)