[MM-63314] Fix ClaimJob in HA environments (#30383)
* ClaimJob now returns newly claimed job * internal code affected by change * test changes required * two branches: for mysql, use transaction; for postgres, use returning * two branches: for mysql, use transaction; for postgres, use returning * use same millis value for LastActivityAt and StartAt * blank commit --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c9504925e6
Коммит
c049748b88
@@ -478,22 +478,24 @@ func (_m *JobStore) UpdateStatus(id string, status string) (*model.Job, error) {
|
||||
}
|
||||
|
||||
// UpdateStatusOptimistically provides a mock function with given fields: id, currentStatus, newStatus
|
||||
func (_m *JobStore) UpdateStatusOptimistically(id string, currentStatus string, newStatus string) (bool, error) {
|
||||
func (_m *JobStore) UpdateStatusOptimistically(id string, currentStatus string, newStatus string) (*model.Job, error) {
|
||||
ret := _m.Called(id, currentStatus, newStatus)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpdateStatusOptimistically")
|
||||
}
|
||||
|
||||
var r0 bool
|
||||
var r0 *model.Job
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) (bool, error)); ok {
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) (*model.Job, error)); ok {
|
||||
return rf(id, currentStatus, newStatus)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) bool); ok {
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) *model.Job); ok {
|
||||
r0 = rf(id, currentStatus, newStatus)
|
||||
} else {
|
||||
r0 = ret.Get(0).(bool)
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Job)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string, string) error); ok {
|
||||
|
||||
Ссылка в новой задаче
Block a user