Count all pending cache states
This commit is contained in:
@@ -1111,7 +1111,7 @@
|
||||
try {
|
||||
const j = await api(`/api/admin/cache/health?limit=50&offset=${cacheOffset}`);
|
||||
if (!j.ok) throw Error(j.error || 'Cache health unavailable.');
|
||||
const ready = j.statuses.find(x => x.status === 'ready') || {}, pending = j.statuses.find(x => ['queued', 'downloading', 'validating'].includes(x.status)), failed = j.statuses.find(x => x.status === 'failed') || {};
|
||||
const ready = j.statuses.find(x => x.status === 'ready') || {}, pending = j.statuses.filter(x => ['queued', 'downloading', 'validating'].includes(x.status)).reduce((sum, item) => ({ count: sum.count + Number(item.count || 0), bytes: sum.bytes + Number(item.bytes || 0) }), { count: 0, bytes: 0 }), failed = j.statuses.find(x => x.status === 'failed') || {};
|
||||
$('cacheMetrics').innerHTML = [
|
||||
['Cache used', `${bytes(j.bytes)} / ${bytes(j.budget)}`, `${Math.round(j.utilization * 100)}% of configured budget`],
|
||||
['Ready', Number(ready.count || 0).toLocaleString(), bytes(ready.bytes || 0)],
|
||||
|
||||
Reference in New Issue
Block a user