v0.0.9: per-file timer — 3.2с → ✓ 12.5с
Deploy drhider / validate (push) Waiting to run

This commit is contained in:
2026-07-13 11:06:52 +04:00
parent bf202cdfa4
commit c878b3db1a
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
sys.path.insert(0, _sys_path_root)
# Версия приложения (меняется при изменениях)
VERSION = "0.0.8"
VERSION = "0.0.9"
def create_app():
+10 -2
View File
@@ -205,6 +205,8 @@ async function uploadFiles() {
// Фаза 2: обработка (SSE — прогресс по каждому файлу)
for (let i = 0; i < total; i++) ss(i, '<span style="color:#2563eb">⏳</span>');
const fileTimers = {}; // idx -> performance.now()
const fileIntervals = {}; // idx -> setInterval id
st.className = 'status progress';
st.textContent = 'Обработка...';
const t0 = performance.now();
@@ -218,11 +220,17 @@ async function uploadFiles() {
const es = new EventSource('/api/process_stream/' + currentSid);
es.addEventListener('start', function(e) {
const d = JSON.parse(e.data);
ss(d.idx, '<span style="color:#2563eb">⏳ обработка</span>');
fileTimers[d.idx] = performance.now();
fileIntervals[d.idx] = setInterval(function() {
const elapsed = ((performance.now() - fileTimers[d.idx]) / 1000).toFixed(1);
ss(d.idx, '<span style="color:#2563eb">⏳ ' + elapsed + 'с</span>');
}, 200);
});
es.addEventListener('done', function(e) {
const d = JSON.parse(e.data);
ss(d.idx, '<span style="color:#22c55e">✓</span>');
clearInterval(fileIntervals[d.idx]);
const elapsed = ((performance.now() - (fileTimers[d.idx] || performance.now())) / 1000).toFixed(1);
ss(d.idx, '<span style="color:#22c55e">✓ ' + elapsed + 'с</span>');
});
es.addEventListener('complete', function(e) {
es.close();