MM-53747: Do not start if job is in-progress as well. (#24115)
We missed this out last time. It's possible in an HA scenario for a second pod to start later while the other job is in-progress. In that case, it would schedule two jobs. https://mattermost.atlassian.net/browse/MM-53747 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f10487c511
Коммит
b47754e268
@@ -4534,6 +4534,22 @@ func (s *TimerLayerJobStore) Save(job *model.Job) (*model.Job, error) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerJobStore) SaveOnce(job *model.Job) (*model.Job, error) {
|
||||
start := time.Now()
|
||||
|
||||
result, err := s.JobStore.SaveOnce(job)
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
success := "false"
|
||||
if err == nil {
|
||||
success = "true"
|
||||
}
|
||||
s.Root.Metrics.ObserveStoreMethodDuration("JobStore.SaveOnce", success, elapsed)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerJobStore) UpdateOptimistically(job *model.Job, currentStatus string) (bool, error) {
|
||||
start := time.Now()
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user