Commit a5745bd
committed
Doorkeeper API の504エラーに対するリトライ処理とタイムアウト設定を追加
## 変更内容
### 1. タイムアウト設定の追加 (lib/event_service/client.rb)
- 接続タイムアウト: 10秒
- 読み取りタイムアウト: 60秒
- 無限待機を防止
### 2. サーバーエラーのリトライ処理 (lib/event_service/providers/doorkeeper.rb)
- 502/503/504エラーを検出して自動リトライ
- Exponential backoff: 10秒 → 20秒 → 40秒
- 最大3回までリトライ
- group_id を含む詳細なエラーログ
### 3. 詳細なログ出力 (lib/statistics/tasks/doorkeeper.rb)
- どのDojoを処理中かを表示
- 取得成功時のイベント数を表示
- エラー発生時にDojo名とgroup_idを記録
## 動作確認
ローカル環境で以下のタスクを実行し、正常動作を確認:
- `bundle exec rails statistics:aggregation`
- 51個のDojoを正常に処理
- `bundle exec rails upcoming_events:aggregation`
- Connpass: 116イベント取得
- Doorkeeper: 2箇所で504エラー発生 → リトライで成功
## テスト
全216テストが成功:
```
bundle exec rspec spec
216 examples, 0 failures
```
## 関連Issue
統計/地図スクリプトの504エラーに対応1 parent b42a31c commit a5745bd
File tree
3 files changed
+38
-20
lines changed- lib
- event_service
- providers
- statistics/tasks
3 files changed
+38
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
28 | 27 | | |
29 | | - | |
30 | | - | |
| 28 | + | |
| 29 | + | |
31 | 30 | | |
32 | | - | |
| 31 | + | |
33 | 32 | | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 37 | + | |
| 38 | + | |
44 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
49 | 62 | | |
50 | 63 | | |
51 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
0 commit comments