| 275 | const rateStore = new Map(); |
| 276 | |
| 277 | const concurrentRateCheck = clientCount => { |
| 278 | const currentTime = Math.floor(Date.now() / 1000); |
| 279 | |
| 280 | for (let i = 0; i < clientCount; i++) { |
| 281 | const clientId = `client-${i}`; |
| 282 | |
| 283 | if (!rateStore.has(clientId)) { |
| 284 | rateStore.set(clientId, { |
| 285 | remaining: 100, |
| 286 | reset: currentTime + 900 |
| 287 | }); |
| 288 | } |
| 289 | |
| 290 | const state = rateStore.get(clientId); |
| 291 | if (state.remaining > 0) { |
| 292 | state.remaining--; |
| 293 | } |
| 294 | } |
| 295 | }; |
| 296 | |
| 297 | suite |
| 298 | .add("Rate Limit - 10 concurrent clients", () => { |
no outgoing calls
no test coverage detected