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
```
Этот коммит содержится в:
Agniva De Sarker
2023-07-26 20:32:50 +05:30
коммит произвёл GitHub
родитель f10487c511
Коммит b47754e268
9 изменённых файлов: 247 добавлений и 6 удалений

Просмотреть файл

@@ -713,6 +713,10 @@ type ReactionStore interface {
type JobStore interface {
Save(job *model.Job) (*model.Job, error)
// SaveOnce will only insert the job with the same category once.
// If this method is called concurrently with another job of the same type,
// then nil, nil is returned.
SaveOnce(job *model.Job) (*model.Job, error)
UpdateOptimistically(job *model.Job, currentStatus string) (bool, error)
UpdateStatus(id string, status string) (*model.Job, error)
UpdateStatusOptimistically(id string, currentStatus string, newStatus string) (bool, error)