Skip to content

Commit 5ec668c

Browse files
committed
chore: faster real time stats fetching
1 parent d2c3395 commit 5ec668c

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

dashboard/src/components/goal-progress.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export function GoalProgress() {
156156
: t('goal.progress', { defaultValue: 'Progress' })
157157
const remainingLabel = t('goal.remaining')
158158
const ctaLabel = isGithubGoal
159-
? t('goal.starOnGitHub', { defaultValue: 'Star on GitHub' })
159+
? t('donation.starOnGitHub', { defaultValue: 'Star on GitHub' })
160160
: t('goal.contribute')
161161
const ctaHref =
162162
isGithubGoal && currentGoal.repo_owner && currentGoal.repo_name

dashboard/src/components/statistics/Statistics.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export default function Statistics({ data, isLoading, error, selectedServer, is_
3939
const { data: nodeStats, isLoading: isLoadingNodeStats } = useRealtimeNodeStats(selectedNodeId || 0, {
4040
query: {
4141
enabled: is_sudo && !!selectedNodeId, // Only fetch node stats for sudo admins with selected node
42-
refetchInterval: 5000, // Update every 5 seconds
42+
refetchInterval: 1500, // Update every 1.5 seconds for faster realtime updates
43+
staleTime: 1000, // Consider data stale after 1 second
4344
},
4445
})
4546

dashboard/src/components/statistics/SystemStatisticsSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export default function SystemStatisticsSection({ currentStats }: SystemStatisti
167167
</div>
168168

169169
{/* Total Traffic / Network Speed (depends on whether it's master or node stats) */}
170-
<div className="h-full w-full animate-fade-in" style={{ animationDuration: '600ms', animationDelay: '250ms' }}>
170+
<div className="h-full w-full animate-fade-in sm:col-span-2 lg:col-span-1" style={{ animationDuration: '600ms', animationDelay: '250ms' }}>
171171
<Card dir={dir} className="group relative h-full w-full overflow-hidden rounded-lg border transition-all duration-300 hover:shadow-lg">
172172
<div
173173
className={cn(

dashboard/src/pages/_dashboard.statistics.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const Statistics = () => {
2424
const { data, error, isLoading } = useQuery({
2525
queryKey: getGetSystemStatsQueryKey(),
2626
queryFn: () => getSystemStats(),
27-
refetchInterval: selectedServer === 'master' ? 5000 : false, // Only refetch when master is selected
28-
staleTime: 3000, // Consider data stale after 3 seconds
27+
refetchInterval: selectedServer === 'master' ? 2000 : false, // Update every 2 seconds for faster realtime updates
28+
staleTime: 1000, // Consider data stale after 1 second
2929
refetchOnWindowFocus: true,
3030
enabled: selectedServer === 'master', // Only fetch when master is selected
3131
})

0 commit comments

Comments
 (0)