Skip to content
Snippets Groups Projects
Verified Commit c99c7406 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: init stats (now is a pointer) #64

parent b4f38713
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,10 @@ func (j *Job[T]) GetStats() JobStats { ...@@ -83,6 +83,10 @@ func (j *Job[T]) GetStats() JobStats {
j.mu.Lock() j.mu.Lock()
defer j.mu.Unlock() defer j.mu.Unlock()
// workaround for gorm // workaround for gorm
if j.stats == nil {
j.stats = &JobStats{}
}
j.stats.JobID = j.id j.stats.JobID = j.id
return *j.stats return *j.stats
} }
...@@ -117,7 +121,9 @@ func (j *Job[T]) GetPersistence() JobPersistence { ...@@ -117,7 +121,9 @@ func (j *Job[T]) GetPersistence() JobPersistence {
job.Scheduler = j.scheduler.GetPersistence() job.Scheduler = j.scheduler.GetPersistence()
} }
job.Stats.JobID = job.ID if job.Stats != nil {
job.Stats.JobID = job.ID
}
for i := range job.Logs { for i := range job.Logs {
job.Logs[i].JobID = job.ID job.Logs[i].JobID = job.ID
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment