Add a sleep in-between retries (#18853)
* Add a sleep in-between retries From the logs in production, we have observed that practically when a deadlock happens, it always fails even after trying 3 times. Therefore, allowing it some time to recover before trying again. https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=bf0e73f6-fd69-4d04-88af-53922672b556 ```release-note NONE ``` * Fix conflict with variable names ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2ba20b5c82
Коммит
416e227b64
@@ -8,6 +8,7 @@ package retrylayer
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
timepkg "time"
|
||||||
|
|
||||||
"github.com/lib/pq"
|
"github.com/lib/pq"
|
||||||
"github.com/mattermost/mattermost-server/v6/model"
|
"github.com/mattermost/mattermost-server/v6/model"
|
||||||
@@ -74,6 +75,7 @@ func (s *{{$.Name}}{{$substoreName}}Store) {{$index}}({{$element.Params | joinPa
|
|||||||
{{$element.Results | errorVar}} = errors.Wrap({{$element.Results | errorVar}}, "giving up after 3 consecutive repeatable transaction failures")
|
{{$element.Results | errorVar}} = errors.Wrap({{$element.Results | errorVar}}, "giving up after 3 consecutive repeatable transaction failures")
|
||||||
return {{genResultsVars $element.Results false }}
|
return {{genResultsVars $element.Results false }}
|
||||||
}
|
}
|
||||||
|
timepkg.Sleep(100 * timepkg.Millisecond)
|
||||||
}
|
}
|
||||||
{{else}}
|
{{else}}
|
||||||
return s.{{$substoreName}}Store.{{$index}}({{$element.Params | joinParams}})
|
return s.{{$substoreName}}Store.{{$index}}({{$element.Params | joinParams}})
|
||||||
|
|||||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Ссылка в новой задаче
Block a user