Skip to content

Commit 0020323

Browse files
Copilotadameat
andcommitted
Fix duplicate API calls and use real backend data in threads tab
- Remove duplicate getNodeThreads query that was calling the same API endpoint - Update Threads component to use existing getNodeInfo query data - Add Threads field to TSystemStateInfo interface to properly type the thread data - Threads tab now displays real backend data without duplicate API calls - Fixes both issues: no more duplicate sysinfo calls and threads data is properly displayed Co-authored-by: adameat <[email protected]>
1 parent 62b163a commit 0020323

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

src/containers/Node/Threads/Threads.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,13 @@ export function Threads({nodeId, className}: ThreadsProps) {
115115
const [autoRefreshInterval] = useAutoRefreshInterval();
116116

117117
const {
118-
currentData: threadsData,
118+
currentData: nodeData,
119119
isLoading,
120120
error,
121-
} = nodeApi.useGetNodeThreadsQuery({nodeId}, {pollingInterval: autoRefreshInterval});
121+
} = nodeApi.useGetNodeInfoQuery({nodeId}, {pollingInterval: autoRefreshInterval});
122122

123-
const data = threadsData?.Threads || [];
123+
// Extract threads data from the node data
124+
const data = nodeData?.Threads || [];
124125

125126
return (
126127
<div className={b(null, className)}>

src/store/reducers/node/node.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,6 @@ export const nodeApi = api.injectEndpoints({
2626
},
2727
providesTags: ['All'],
2828
}),
29-
getNodeThreads: build.query({
30-
queryFn: async ({nodeId}: {nodeId: string}, {signal}) => {
31-
try {
32-
const data = await window.api.viewer.getNodeInfo(nodeId, {signal});
33-
34-
// Extract thread information from the response
35-
return {
36-
data: {
37-
Threads: data.Threads || [],
38-
ResponseTime: data.ResponseTime,
39-
ResponseDuration: data.ResponseDuration,
40-
},
41-
};
42-
} catch (error) {
43-
return {error};
44-
}
45-
},
46-
providesTags: ['All'],
47-
}),
4829
}),
4930
overrideExisting: 'throw',
5031
});

src/types/api/nodes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {BackendSortParam} from './common';
22
import type {EFlag} from './enums';
33
import type {TPDiskStateInfo} from './pdisk';
44
import type {TTabletStateInfo} from './tablet';
5+
import type {TThreadPoolInfo} from './threads';
56
import type {TVDiskStateInfo} from './vdisk';
67

78
/**
@@ -152,6 +153,8 @@ export interface TSystemStateInfo {
152153
SharedCacheStats?: TNodeSharedCache;
153154
TotalSessions?: number;
154155
NodeName?: string;
156+
/** Detailed thread information when fields_required=-1 is used */
157+
Threads?: TThreadPoolInfo[];
155158
}
156159

157160
interface TNodeStateInfo {

0 commit comments

Comments
 (0)