@@ -84,9 +84,8 @@ use restate_types::invocation::{
8484 AttachInvocationRequest , IngressInvocationResponseSink , InvocationMutationResponseSink ,
8585 InvocationQuery , InvocationResponse , InvocationTarget , InvocationTargetType ,
8686 InvocationTermination , JournalCompletionTarget , NotifySignalRequest , ResponseResult ,
87- ServiceInvocation , ServiceInvocationResponseSink , ServiceInvocationSpanContext , ServiceType ,
88- Source , SubmitNotificationSink , TerminationFlavor , VirtualObjectHandlerType ,
89- WorkflowHandlerType ,
87+ ServiceInvocation , ServiceInvocationResponseSink , ServiceInvocationSpanContext , Source ,
88+ SubmitNotificationSink , TerminationFlavor , VirtualObjectHandlerType , WorkflowHandlerType ,
9089} ;
9190use restate_types:: invocation:: { InvocationInput , SpanRelation } ;
9291use restate_types:: journal:: Completion ;
@@ -4475,12 +4474,8 @@ impl<S> StateMachineApplyContext<'_, S> {
44754474 metadata. timestamps . update ( self . record_created_at ) ;
44764475
44774476 if Configuration :: pinned ( ) . common . experimental_enable_vqueues {
4478- self . vqueue_park_invocation (
4479- & invocation_id,
4480- & metadata. invocation_target ,
4481- ParkCause :: Suspend ,
4482- )
4483- . await ?;
4477+ self . vqueue_park_invocation ( & invocation_id, & metadata. invocation_target )
4478+ . await ?;
44844479 }
44854480
44864481 self . storage
@@ -5115,7 +5110,6 @@ impl<S> StateMachineApplyContext<'_, S> {
51155110 & mut self ,
51165111 invocation_id : & InvocationId ,
51175112 invocation_target : & InvocationTarget ,
5118- cause : ParkCause ,
51195113 ) -> Result < ( ) , Error >
51205114 where
51215115 S : WriteVQueueTable + WriteLockTable + ReadVQueueTable ,
@@ -5150,34 +5144,10 @@ impl<S> StateMachineApplyContext<'_, S> {
51505144
51515145 let now = UniqueTimestamp :: from_unix_millis_unchecked ( self . record_created_at ) ;
51525146
5153- let should_release_concurrency_token = match cause {
5154- ParkCause :: Suspend => {
5155- // Always hold on to your concurrency token until the invocation is completed if
5156- // we are suspending for all types (services, VOs, workflows). This has the benefit
5157- // of an easy to reason about concurrency model for our users. The downside is that
5158- // callers might deadlock if they call a limited service which has no more
5159- // concurrency tokens left and there is a cyclic dependency (e.g. a limited service
5160- // calling itself).
5161- false
5162- }
5163- ParkCause :: Pause => {
5164- // We release the concurrency token in case we are pausing a service because
5165- // unpausing requires human intervention, and we don't want to block other service
5166- // invocations.
5167- //
5168- // Note that we don't do this for paused VOs and workflows because they need to
5169- // ensure that no other instance can run while they hold their lock. Technically,
5170- // we still have the service_status_table which stores the locking information, and
5171- // we need to keep things in sync until we decide what to do with this table.
5172- matches ! ( invocation_target. service_ty( ) , ServiceType :: Service )
5173- }
5174- } ;
5175-
51765147 vqueue. park (
51775148 now,
51785149 & entry_state_header. current_entry_card ( ) ,
51795150 entry_state_header. stage ( ) ,
5180- should_release_concurrency_token,
51815151 ) ?;
51825152
51835153 Ok ( ( ) )
@@ -5378,15 +5348,6 @@ impl<S> StateMachineApplyContext<'_, S> {
53785348 }
53795349}
53805350
5381- /// Cause for parking an invocation
5382- #[ derive( Debug ) ]
5383- enum ParkCause {
5384- /// The invocation suspends to await completion or signals
5385- Suspend ,
5386- /// The invocation pauses because it depleted it retries or was manually paused
5387- Pause ,
5388- }
5389-
53905351// To write completions in the effects log
53915352struct CompletionResultFmt < ' a > ( & ' a CompletionResult ) ;
53925353
0 commit comments