MM-54580: Fix panic in jobs/base_workers.go (#24631)

If GetJob fails, we would return a nil job and then try to log
with that. To prevent this, we keep a reference to the old job
and log with that in the error case.

https://mattermost.atlassian.net/browse/MM-54580

```release-note
Fix a panic where a simple worker would crash if if failed to get a job.
```
Этот коммит содержится в:
Agniva De Sarker
2023-10-03 07:55:38 +05:30
коммит произвёл GitHub
родитель ae1decd1a7
Коммит b9c50641db
3 изменённых файлов: 47 добавлений и 2 удалений

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

@@ -38,6 +38,7 @@ func makeJobServer(t *testing.T) (*JobServer, *storetest.Store, *mocks.MetricsIn
ConfigService: configService,
Store: mockStore,
metrics: mockMetrics,
logger: mlog.CreateConsoleTestLogger(t),
}
return jobServer, mockStore, mockMetrics