Add scheduled job to process pending jobs in LeaveProcessJobStatusRepository
This commit is contained in:
parent
91e6b1b35b
commit
8732c34564
2 changed files with 5 additions and 5 deletions
|
|
@ -128,11 +128,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
|
||||
}
|
||||
|
||||
public async Task ProcessPendingJobsAsync(CancellationToken cancellationToken = default)
|
||||
public async Task ProcessPendingJobsAsync()
|
||||
{
|
||||
// กำหนด timeout เป็น 60 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(60));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
|
||||
|
||||
|
||||
var pendingJobs = await GetPendingOrProcessingJobsAsync();
|
||||
|
|
@ -145,7 +143,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
await UpdateToProcessingAsync(job.Id);
|
||||
|
||||
// ทำงานที่ต้องการที่นี่ (เช่น เรียก API, ประมวลผลข้อมูล ฯลฯ)
|
||||
await ProcessTaskAsync(job.RootDnaId, combinedCts.Token);
|
||||
await ProcessTaskAsync(job.RootDnaId);
|
||||
|
||||
// อัปเดตสถานะเป็น Completed
|
||||
await UpdateToCompletedAsync(job.Id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue