Refactor LeaveProcessJobStatusRepository methods and update Hangfire configuration for improved job processing
This commit is contained in:
parent
8732c34564
commit
3dee5f7166
4 changed files with 25 additions and 16 deletions
|
|
@ -68,10 +68,10 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<LeaveProcessJobStatus>> GetPendingOrProcessingJobsAsync()
|
||||
public async Task<List<LeaveProcessJobStatus>> GetPendingJobsAsync()
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||
.Where(x => x.Status == "PENDING" || x.Status == "PROCESSING")
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
|
|
@ -125,15 +125,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
|
||||
public async Task ProcessTaskAsync(Guid id, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
Console.WriteLine($"กำลังประมวลผลงานที่มี RootDnaId: {id}");
|
||||
}
|
||||
|
||||
public async Task ProcessPendingJobsAsync()
|
||||
{
|
||||
|
||||
|
||||
|
||||
var pendingJobs = await GetPendingOrProcessingJobsAsync();
|
||||
var pendingJobs = await GetPendingJobsAsync();
|
||||
Console.WriteLine($"พบงานที่ค้างอยู่ในสถานะ PENDING จำนวน {pendingJobs.Count} งาน");
|
||||
|
||||
foreach (var job in pendingJobs)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue