mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(traffic): name an account's traffic limit instead of a daily budget
A failed flow tile now carries the server's reason. A hosted deployment that limits each account answers USAGE_LIMIT_REACHED or RATE_LIMITED, which the traffic panel labels as the monthly allowance or a rate limit; a 503 with another reason reads as the traffic service being unavailable, not a missing key. The local proxy's no_key and daily budget labels are unchanged.
This commit is contained in:
1 parent
ad009ea1eb
commit
58adbb11c7
15 files changed
+119
-1
No files matched your search
@@ -1050,3 +1050,29 @@ test('cancelling a flow body releases its freshness before a new request', async
|
||||
assert.equal(getEventListeners(requestSignal, 'abort').length, 0);
|
||||
assert.equal(source.getFlowSessionStats().cacheEntries, 0);
|
||||
});
|
||||
|
||||
test('a failed flow tile carries the server reason for its label', async () => {
|
||||
for (const [status, body, code] of [
|
||||
[
|
||||
429,
|
||||
{ error: 'Monthly usage limit reached', code: 'USAGE_LIMIT_REACHED' },
|
||||
'USAGE_LIMIT_REACHED',
|
||||
],
|
||||
[
|
||||
429,
|
||||
{ error: 'Request rate limit reached', code: 'RATE_LIMITED' },
|
||||
'RATE_LIMITED',
|
||||
],
|
||||
[503, { error: 'no_key' }, 'no_key'],
|
||||
[503, { error: 'Usage enforcement is temporarily unavailable' }, null],
|
||||
]) {
|
||||
const source = createFlowTileSource({
|
||||
fetchImpl: async () => Response.json(body, { status }),
|
||||
});
|
||||
await assert.rejects(source.fetchFlowForBounds(bounds), (error) => {
|
||||
assert.equal(error.status, status);
|
||||
assert.equal(error.code, code);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user