perf: serve long-range studies from a decoded closed-day cache
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4143bf599e
commit
4ca9c7bf0c
16 files changed
+846
-83
No files matched your search
@@ -301,9 +301,17 @@
|
||||
if (r.status >= 500) { showError(t('error.load')); throw mkErr('HTTP ' + r.status, r.status); }
|
||||
if (!r.ok) throw mkErr('HTTP ' + r.status, r.status);
|
||||
hideError();
|
||||
return r.json();
|
||||
return r.json().then(function (j) { if (j && j.truncated === true) noteTruncated(); return j; });
|
||||
}, function (e) { showError(t('error.load')); throw e; });
|
||||
}
|
||||
// A study that hit a real limit (event count, byte budget or time) says so; shown at most once per 20 s.
|
||||
var truncAt = 0;
|
||||
function noteTruncated() {
|
||||
var now = Date.now();
|
||||
if (now - truncAt < 20000) return;
|
||||
truncAt = now;
|
||||
toast(t('study.truncated'), 9000);
|
||||
}
|
||||
function qs(extra) {
|
||||
var o = Object.assign({ host: state.host }, rangeParams());
|
||||
for (var k in extra) o[k] = extra[k];
|
||||
@@ -982,12 +990,12 @@
|
||||
});
|
||||
}
|
||||
var toastBox = null;
|
||||
function toast(msg) {
|
||||
function toast(msg, ms) {
|
||||
if (!toastBox) toastBox = $('#toasts');
|
||||
if (!toastBox) return;
|
||||
var n = h('div', 'toast', String(msg));
|
||||
toastBox.appendChild(n);
|
||||
setTimeout(function () { if (n.parentNode) n.parentNode.removeChild(n); }, 2600);
|
||||
setTimeout(function () { if (n.parentNode) n.parentNode.removeChild(n); }, ms || 2600);
|
||||
}
|
||||
|
||||
// POST/DELETE with a JSON body (same-origin cookie session); resolves with the parsed answer or rejects with its status.
|
||||
|
||||
@@ -43,6 +43,7 @@ window.URUTAU_I18N = {
|
||||
'range.widen': 'Choose another period',
|
||||
'timeline.bucket': '{n}-minute buckets',
|
||||
'toast.copied': 'Copied',
|
||||
'study.truncated': 'This period is too large to read in full: the figures cover only part of the events. Pick a shorter range for exact numbers.',
|
||||
'unban.btn': 'Unban',
|
||||
'unban.title': 'Unban {ip}',
|
||||
'unban.explain': 'This lifts the block on this address in the server firewall (fail2ban) right away. Use it when the block was a mistake or when you are testing your own system.',
|
||||
@@ -579,6 +580,7 @@ window.URUTAU_I18N = {
|
||||
'range.widen': 'Escolher outro período',
|
||||
'timeline.bucket': 'caixas de {n} min',
|
||||
'toast.copied': 'Copiado',
|
||||
'study.truncated': 'Este período é grande demais para ser lido por inteiro: os números cobrem só parte dos eventos. Escolha um intervalo menor para valores exatos.',
|
||||
'unban.btn': 'Desbanir',
|
||||
'unban.title': 'Desbanir {ip}',
|
||||
'unban.explain': 'Isto libera agora o bloqueio deste endereço no firewall do servidor (fail2ban). Use quando o bloqueio foi um engano ou quando você está testando o seu próprio sistema.',
|
||||
|
||||
Reference in new issue
Block a user