@@ -37,7 +37,7 @@ public LocalCliBackend(
3737 stateStore . JobUpserted += summary => Publish ( "job.upserted" , summary ) ;
3838 stateStore . WorkflowUpserted += summary => Publish ( "workflow.upserted" , summary ) ;
3939 stateStore . SearchUpdated += update => Publish ( "search.updated" , update ) ;
40- new EngineEventDtoAdapter ( GetSummary , Publish ) . Attach ( engine . Events ) ;
40+ new EngineEventDtoAdapter ( GetSummary , Publish ) . Attach ( engine . Events , engine . SearchEvents ) ;
4141 }
4242
4343 public Task < JobSummaryDto > SubmitExtractJobAsync ( SubmitExtractJobRequestDto request , CancellationToken ct = default )
@@ -519,24 +519,14 @@ public Task<bool> CancelJobAsync(Guid jobId, CancellationToken ct = default)
519519 {
520520 ct . ThrowIfCancellationRequested ( ) ;
521521
522- var job = engine . GetJob ( jobId ) ;
523- if ( job == null )
524- return Task . FromResult ( false ) ;
525-
526- job . Cancel ( JobCancellationSource . UserRequestedJob ) ;
527- return Task . FromResult ( true ) ;
522+ return Task . FromResult ( engine . CancelJob ( jobId ) ) ;
528523 }
529524
530525 public async Task < bool > CancelJobByDisplayIdAsync ( int displayId , Guid ? workflowId = null , CancellationToken ct = default )
531526 {
532527 ct . ThrowIfCancellationRequested ( ) ;
533528
534- var job = engine . GetJob ( displayId ) ;
535- if ( job == null || ( workflowId . HasValue && job . WorkflowId != workflowId . Value ) )
536- return false ;
537-
538- job . Cancel ( JobCancellationSource . UserRequestedJob ) ;
539- return await Task . FromResult ( true ) ;
529+ return await Task . FromResult ( engine . CancelJobByDisplayId ( displayId , workflowId ) ) ;
540530 }
541531
542532 public Task < int > CancelWorkflowAsync ( Guid workflowId , CancellationToken ct = default )
@@ -554,11 +544,7 @@ public Task<bool> TryNextCandidateAsync(Guid jobId, CancellationToken ct = defau
554544 public Task < bool > TryNextCandidateByDisplayIdAsync ( int displayId , Guid ? workflowId = null , CancellationToken ct = default )
555545 {
556546 ct . ThrowIfCancellationRequested ( ) ;
557- var job = engine . GetJob ( displayId ) ;
558- if ( job == null || ( workflowId . HasValue && job . WorkflowId != workflowId . Value ) )
559- return Task . FromResult ( false ) ;
560-
561- return Task . FromResult ( engine . TryNextCandidate ( job . Id ) ) ;
547+ return Task . FromResult ( engine . TryNextCandidateByDisplayId ( displayId , workflowId ) ) ;
562548 }
563549
564550 private void Publish ( string type , object payload )
0 commit comments