fix: print stats if updated

This commit is contained in:
Shusui MOYATANI
2023-10-05 02:14:35 +09:00
parent 6bec8757bf
commit 53c770a764

View File

@@ -1,3 +1,5 @@
import { createEffect, createRoot } from 'solid-js';
import { createStore } from 'solid-js/store';
export type Stats = {
@@ -10,9 +12,11 @@ const [stats, setStats] = createStore<Stats>({
activeBatchSubscriptions: 0,
});
setInterval(() => {
console.debug('stats', { ...stats });
}, 1000);
createRoot(() => {
createEffect(() => {
console.debug('stats', { ...stats });
});
});
const useStats = () => {
const setActiveSubscriptions = (count: number) => setStats('activeSubscriptions', count);