Skip to content

Commit 3c8481e

Browse files
committed
perf(views): reduce memory usage by only parsing the last 10 responses
1 parent cd30b65 commit 3c8481e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

views/responses.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
const text = await responsesRes.text();
6767

6868
const lines = text.trim().split('\n').filter(l => l);
69-
const entries = lines.map(l => JSON.parse(l));
69+
// Only parse and display the last 10 responses to reduce memory usage
70+
const lastLines = lines.slice(-10);
71+
const entries = lastLines.map(l => JSON.parse(l));
7072

7173
const newLastId = entries[entries.length - 1]?.id;
7274
if (newLastId === lastResponseId) return;
@@ -82,7 +84,7 @@
8284
}
8385

8486
fetchResponses();
85-
setInterval(fetchResponses, 100);
87+
setInterval(fetchResponses, 1000);
8688
</script>
8789
</body>
8890
</html>

0 commit comments

Comments
 (0)