Skip to content

Commit 213a661

Browse files
Fix little bug with run cancellation
1 parent 1a29ff7 commit 213a661

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/endpoint/context.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use futures::{FutureExt, TryFutureExt};
1616
use pin_project_lite::pin_project;
1717
use restate_sdk_shared_core::{
1818
CoreVM, DoProgressResponse, Error as CoreError, NonEmptyValue, NotificationHandle, RetryPolicy,
19-
RunExitResult, TakeOutputResult, Target, Value, VM,
19+
RunExitResult, TakeOutputResult, Target, TerminalFailure, Value, VM,
2020
};
2121
use std::borrow::Cow;
2222
use std::collections::HashMap;
@@ -859,6 +859,19 @@ where
859859
closure_fut: closure.run(),
860860
});
861861
}
862+
Ok(DoProgressResponse::CancelSignalReceived) => {
863+
drop(inner_ctx);
864+
// Got cancellation!
865+
this.state.set(RunState::WaitingResultFut {
866+
result_fut: async {
867+
Ok(Err(TerminalError::from(TerminalFailure {
868+
code: 409,
869+
message: "cancelled".to_string(),
870+
})))
871+
}
872+
.boxed(),
873+
})
874+
}
862875
_ => {
863876
drop(inner_ctx);
864877
// In all the other cases, just move on waiting the result,

0 commit comments

Comments
 (0)