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

HTTP通信時に例外が発生した場合の対応 #66

Closed
pgrho opened this issue Sep 5, 2017 · 3 comments
Closed

HTTP通信時に例外が発生した場合の対応 #66

pgrho opened this issue Sep 5, 2017 · 3 comments

Comments

@pgrho
Copy link
Collaborator

pgrho commented Sep 5, 2017

  1. MetadataFetchAsyncCoreでHTTP通信に失敗した場合、正常な結果を返すまで(最大30s程度の間)再試行を行うかどうか
  2. 1.のリトライがすべて失敗して結局例外をスローした場合、次回のFetchAsyncではキャッシュされているTask.StatusFaultedになっているが、そのままキャッシュを返すかどうか。またFaultedなキャッシュに有効期間を設けるかどうか。

個人的提案としては

  1. 1s, 2s, 4s, 8sのウェイトを置いて最大4回リトライする。
  2. 例外発生から5分間有効とする

ぐらいかなー。数字に根拠はないけど。

ちなみにAmazonMetadataProviderは仕様上ガンガン例外が返ってくるので80ms~1280msでリトライしてます。

@supermomonga
Copy link
Owner

1s, 2s, 4s, 8sのウェイトを置いて最大4回リトライする。

よさそう。でも単純に1,2,4,8とするよりは https://github.com/mperham/sidekiq/wiki/Error-Handling#automatic-job-retry このあたり参考に (retry_count ** 4) + 5 とかの方がよさそう。MoEmbedでは random number の加算は要らないかな…

例外発生から5分間有効とする

よさそう

最大n回リトライ、5分間有効の数字は設定可能であるとよさそう

@pgrho
Copy link
Collaborator Author

pgrho commented Sep 5, 2017

いつも使っているウェイトの取り方はmin(c * f ^ n, max)かな。
Amazonの例だとc = 80ms, f = 2, max = 1280msで計算している。

@supermomonga
Copy link
Owner

よさそう。あとはAmazonとかの例考えるとサイト(Metadata)によってその辺り調整できればよさそげ

@pgrho pgrho mentioned this issue Sep 5, 2017
@pgrho pgrho closed this as completed Sep 5, 2017
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

No branches or pull requests

2 participants