Commit d2989e2
committed
Wire cooldown.js into the model cascade: skip models known to be rate-limited, record a cooldown on 429
Before this, every callGenerateContent call restarted the cascade from GEMINI_MODEL fresh even if that exact model was 429'd seconds ago in a previous invocation -- wasting a quota-consuming request re-hitting it before falling through to the next model. Now the cascade checks isModelCoolingDown() before attempting each model (skipping straight past ones still in cooldown, best-effort via Redis) and calls setModelCooldown() with the parsed retry-delay when a 429 actually happens, so subsequent calls (this process or another, since Vercel doesn't guarantee warm reuse) benefit immediately. Still never sleeps/retries the same model inline -- only ever skips or falls through, same control flow shape as before.1 parent 224a9a4 commit d2989e2
1 file changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
52 | 62 | | |
53 | | - | |
54 | | - | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
60 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
61 | 74 | | |
62 | 75 | | |
63 | 76 | | |
| |||
0 commit comments