Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: exponential backoff #293

Merged
merged 4 commits into from
Nov 22, 2022
Merged

add: exponential backoff #293

merged 4 commits into from
Nov 22, 2022

Conversation

gassara-kys
Copy link
Collaborator

@gassara-kys gassara-kys commented Nov 21, 2022

Deadlockの対処法としてMySQL公式ドキュメントを参考にアプリ側にリトライの仕組みを導入しようと思います。

全体に導入するというより、まずは実際にDeadlockが発生している処理にしぼって設定する方針です。
Backoffの実装は以下のライブラリを使いました。
https://pkg.go.dev/github.com/cenkalti/backoff/v4

リトライのロジックは↓準拠のものになっています。
https://en.wikipedia.org/wiki/Exponential_backoff

@gassara-kys
Copy link
Collaborator Author

過去数週間分のエラーログをみたところ以下のメソッドもRetryの仕組み追加しました

UpsertFinding
TagFinding
UpsertResource
TagResource
UpsertRecommend
UpsertRecommendFinding

Copy link
Contributor

@iiiidaaa iiiidaaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gassara-kys gassara-kys merged commit de89f32 into master Nov 22, 2022
@gassara-kys gassara-kys deleted the backoff branch November 22, 2022 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants