[backend/core] Fix queue system logging rendering UTC timestamps & reporting of incorrect duration for delayed jobs due to time zone differences
This commit is contained in:
parent
7eba307d0a
commit
5556832de0
2 changed files with 4 additions and 4 deletions
|
@ -34,7 +34,7 @@ public class Job
|
|||
[Column("data")] public string Data { get; set; } = null!;
|
||||
|
||||
[NotMapped]
|
||||
public long Duration => (long)((FinishedAt ?? DateTime.Now) - (StartedAt ?? QueuedAt)).TotalMilliseconds;
|
||||
public long Duration => (long)((FinishedAt ?? DateTime.UtcNow) - (StartedAt ?? QueuedAt)).TotalMilliseconds;
|
||||
|
||||
[NotMapped] public long QueueDuration => (long)((StartedAt ?? DateTime.Now) - QueuedAt).TotalMilliseconds;
|
||||
[NotMapped] public long QueueDuration => (long)((StartedAt ?? DateTime.UtcNow) - QueuedAt).TotalMilliseconds;
|
||||
}
|
|
@ -348,8 +348,8 @@ public class PostgresJobQueue<T>(
|
|||
{
|
||||
var logger = scope.ServiceProvider.GetRequiredService<ILogger<QueueService>>();
|
||||
logger.LogTrace("Job in queue {queue} was delayed to {time} after {duration} ms, has been queued since {time}",
|
||||
name, job.DelayedUntil.Value.ToStringIso8601Like(), job.Duration,
|
||||
job.QueuedAt.ToStringIso8601Like());
|
||||
name, job.DelayedUntil.Value.ToLocalTime().ToStringIso8601Like(), job.Duration,
|
||||
job.QueuedAt.ToLocalTime().ToStringIso8601Like());
|
||||
db.Update(job);
|
||||
await db.SaveChangesAsync(token);
|
||||
await RaiseJobDelayedEvent(db);
|
||||
|
|
Loading…
Add table
Reference in a new issue