(kv: KVNamespace)
| 56 | } |
| 57 | |
| 58 | async function getTokenPool(kv: KVNamespace): Promise<{ id: string; token: string }[]> { |
| 59 | const list = await kv.list({ prefix: "rt:" }); |
| 60 | const tokens: { id: string; token: string }[] = []; |
| 61 | for (const key of list.keys) { |
| 62 | const token = await kv.get(key.name); |
| 63 | if (token) tokens.push({ id: key.name.replace("rt:", ""), token }); |
| 64 | } |
| 65 | return tokens; |
| 66 | } |
| 67 | |
| 68 | let tokenRoundRobinIndex = 0; |
| 69 |
no outgoing calls
no test coverage detected