feat(editor): Finalize workers view (#8052)

https://linear.app/n8n/issue/PAY-1065
This commit is contained in:
Iván Ovejero
2023-12-20 17:49:14 +01:00
committed by GitHub
parent d917dfe9f8
commit edfa78414d
7 changed files with 19 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ export const WORKER_HISTORY_LENGTH = 100;
const STALE_SECONDS = 120 * 1000;
export interface IOrchestrationStoreState {
initialStatusReceived: boolean;
workers: { [id: string]: IPushDataWorkerStatusPayload };
workersHistory: {
[id: string]: IWorkerHistoryItem[];
@@ -22,6 +23,7 @@ export interface IWorkerHistoryItem {
export const useOrchestrationStore = defineStore('orchestrationManager', {
state: (): IOrchestrationStoreState => ({
initialStatusReceived: false,
workers: {},
workersHistory: {},
workersLastUpdated: {},
@@ -38,6 +40,8 @@ export const useOrchestrationStore = defineStore('orchestrationManager', {
this.workersHistory[data.workerId].shift();
}
this.workersLastUpdated[data.workerId] = Date.now();
this.initialStatusReceived = true;
},
removeStaleWorkers() {
for (const id in this.workersLastUpdated) {