Explorer: speed up cluster stat loading (#13016)
This commit is contained in:
parent
efdb560e97
commit
f11c86b2c5
|
@ -45,13 +45,8 @@ export function dashboardInfoReducer(
|
||||||
state: DashboardInfo,
|
state: DashboardInfo,
|
||||||
action: DashboardInfoAction
|
action: DashboardInfoAction
|
||||||
) {
|
) {
|
||||||
const status =
|
|
||||||
state.avgSlotTime_1h !== 0 && state.epochInfo.absoluteSlot !== 0
|
|
||||||
? ClusterStatsStatus.Ready
|
|
||||||
: ClusterStatsStatus.Loading;
|
|
||||||
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case DashboardInfoActionType.SetPerfSamples:
|
case DashboardInfoActionType.SetPerfSamples: {
|
||||||
if (action.data.length < 1) {
|
if (action.data.length < 1) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -68,27 +63,43 @@ export function dashboardInfoReducer(
|
||||||
return sum + cur;
|
return sum + cur;
|
||||||
}, 0) / samplesInHour;
|
}, 0) / samplesInHour;
|
||||||
|
|
||||||
|
const status =
|
||||||
|
state.epochInfo.absoluteSlot !== 0
|
||||||
|
? ClusterStatsStatus.Ready
|
||||||
|
: ClusterStatsStatus.Loading;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
avgSlotTime_1h,
|
avgSlotTime_1h,
|
||||||
avgSlotTime_1min: samples[0],
|
avgSlotTime_1min: samples[0],
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
case DashboardInfoActionType.SetEpochInfo:
|
}
|
||||||
|
|
||||||
|
case DashboardInfoActionType.SetEpochInfo: {
|
||||||
|
const status =
|
||||||
|
state.avgSlotTime_1h !== 0
|
||||||
|
? ClusterStatsStatus.Ready
|
||||||
|
: ClusterStatsStatus.Loading;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
epochInfo: action.data,
|
epochInfo: action.data,
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
case DashboardInfoActionType.SetError:
|
case DashboardInfoActionType.SetError:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
status: ClusterStatsStatus.Error,
|
status: ClusterStatsStatus.Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
case DashboardInfoActionType.Reset:
|
case DashboardInfoActionType.Reset:
|
||||||
return {
|
return {
|
||||||
...action.data,
|
...action.data,
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,13 +50,8 @@ export function performanceInfoReducer(
|
||||||
state: PerformanceInfo,
|
state: PerformanceInfo,
|
||||||
action: PerformanceInfoAction
|
action: PerformanceInfoAction
|
||||||
) {
|
) {
|
||||||
const status =
|
|
||||||
state.avgTps !== 0 && state.transactionCount !== 0
|
|
||||||
? ClusterStatsStatus.Ready
|
|
||||||
: ClusterStatsStatus.Loading;
|
|
||||||
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PerformanceInfoActionType.SetPerfSamples:
|
case PerformanceInfoActionType.SetPerfSamples: {
|
||||||
if (action.data.length < 1) {
|
if (action.data.length < 1) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +76,11 @@ export function performanceInfoReducer(
|
||||||
Math.max(...perfHistory.long)
|
Math.max(...perfHistory.long)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const status =
|
||||||
|
state.transactionCount !== 0
|
||||||
|
? ClusterStatsStatus.Ready
|
||||||
|
: ClusterStatsStatus.Loading;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
historyMaxTps,
|
historyMaxTps,
|
||||||
|
@ -88,21 +88,32 @@ export function performanceInfoReducer(
|
||||||
perfHistory,
|
perfHistory,
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
case PerformanceInfoActionType.SetTransactionCount:
|
}
|
||||||
|
|
||||||
|
case PerformanceInfoActionType.SetTransactionCount: {
|
||||||
|
const status =
|
||||||
|
state.avgTps !== 0
|
||||||
|
? ClusterStatsStatus.Ready
|
||||||
|
: ClusterStatsStatus.Loading;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
transactionCount: action.data,
|
transactionCount: action.data,
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
case PerformanceInfoActionType.SetError:
|
case PerformanceInfoActionType.SetError:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
status: ClusterStatsStatus.Error,
|
status: ClusterStatsStatus.Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
case PerformanceInfoActionType.Reset:
|
case PerformanceInfoActionType.Reset:
|
||||||
return {
|
return {
|
||||||
...action.data,
|
...action.data,
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue