@@ -128,12 +128,14 @@ public function handle(): void
128128 ->wherePivot ('parent_index ' , '!= ' , StoredWorkflow::ACTIVE_WORKFLOW_INDEX )
129129 ->first ();
130130
131- $ log = $ this ->storedWorkflow ->logs ()
132- ->whereIndex ($ this ->index )
131+ $ logs = $ this ->storedWorkflow ->logs ()
132+ ->whereIn ('index ' , [$ this ->index , $ this ->index + 1 ])
133+ ->get ();
134+
135+ $ log = $ logs ->where ('index ' , $ this ->index )
133136 ->first ();
134137
135- $ nextLog = $ this ->storedWorkflow ->logs ()
136- ->whereIndex ($ this ->index + 1 )
138+ $ nextLog = $ logs ->where ('index ' , $ this ->index + 1 )
137139 ->first ();
138140
139141 $ this ->storedWorkflow
@@ -167,12 +169,14 @@ public function handle(): void
167169 while ($ this ->coroutine ->valid ()) {
168170 $ this ->index = WorkflowStub::getContext ()->index ;
169171
170- $ log = $ this ->storedWorkflow ->logs ()
171- ->whereIndex ($ this ->index )
172+ $ logs = $ this ->storedWorkflow ->logs ()
173+ ->whereIn ('index ' , [$ this ->index , $ this ->index + 1 ])
174+ ->get ();
175+
176+ $ log = $ logs ->where ('index ' , $ this ->index )
172177 ->first ();
173178
174- $ nextLog = $ this ->storedWorkflow ->logs ()
175- ->whereIndex ($ this ->index + 1 )
179+ $ nextLog = $ logs ->where ('index ' , $ this ->index + 1 )
176180 ->first ();
177181
178182 if ($ log ) {
0 commit comments