mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45:35 +08:00
perf: batch signals
This commit is contained in:
parent
e04ec712ea
commit
0015468077
@ -7,6 +7,7 @@ import { SolidApexCharts } from 'solid-apexcharts'
|
|||||||
import {
|
import {
|
||||||
JSX,
|
JSX,
|
||||||
ParentComponent,
|
ParentComponent,
|
||||||
|
batch,
|
||||||
children,
|
children,
|
||||||
createEffect,
|
createEffect,
|
||||||
createMemo,
|
createMemo,
|
||||||
@ -36,8 +37,10 @@ export default () => {
|
|||||||
// TODO: needs a better way
|
// TODO: needs a better way
|
||||||
makeTimer(
|
makeTimer(
|
||||||
() => {
|
() => {
|
||||||
|
batch(() => {
|
||||||
setTraffics((traffics) => traffics.slice(-CHART_MAX_XAXIS))
|
setTraffics((traffics) => traffics.slice(-CHART_MAX_XAXIS))
|
||||||
setMemories((memo) => memo.slice(-CHART_MAX_XAXIS))
|
setMemories((memo) => memo.slice(-CHART_MAX_XAXIS))
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// we shrink the chart data array size down every 10 minutes to prevent memory leaks
|
// we shrink the chart data array size down every 10 minutes to prevent memory leaks
|
||||||
10 * 60 * 1000,
|
10 * 60 * 1000,
|
||||||
|
Loading…
Reference in New Issue
Block a user