Skip to content

Commit

Permalink
Update BackgroundMqServices.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Mar 27, 2024
1 parent 83cdd54 commit 9cda9ae
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions MyApp.ServiceInterface/BackgroundMqServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,18 @@ public async Task Any(DbWrites request)
},
x => x.PostId == request.FailJob.Id);
var postJob = await Db.SingleByIdAsync<PostJob>(request.FailJob.Id);
if (postJob.RetryCount > 3)
if (postJob != null)
{
await Db.UpdateOnlyAsync(() =>
new PostJob { CompletedDate = DateTime.UtcNow },
x => x.PostId == request.FailJob.Id);
}
else
{
modelWorkers.Enqueue(postJob);
if (postJob.RetryCount > 3)
{
await Db.UpdateOnlyAsync(() =>
new PostJob { CompletedDate = DateTime.UtcNow },
x => x.PostId == request.FailJob.Id);
}
else
{
modelWorkers.Enqueue(postJob);
}
}
}

Expand Down

0 comments on commit 9cda9ae

Please sign in to comment.