From 4298d8d81c9bea0fb4c0f115dfa2b04ea72f0006 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 5 Jun 2018 03:43:09 +0200 Subject: kill cleanly --- app/client/system/system.reducer.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'app/client/system/system.reducer.js') diff --git a/app/client/system/system.reducer.js b/app/client/system/system.reducer.js index 27c248a..c20bf93 100644 --- a/app/client/system/system.reducer.js +++ b/app/client/system/system.reducer.js @@ -44,6 +44,7 @@ const systemInitialState = { } const systemReducer = (state = systemInitialState, action) => { + let processor = null switch(action.type) { case types.socket.connect: case types.socket.reconnecting: @@ -174,8 +175,13 @@ const systemReducer = (state = systemInitialState, action) => { stderr: "", } case types.task.task_finish: - if (state.runner[action.task.processor].task.uuid !== action.task.uuid) { - return state + if (state.runner.cpu.task.uuid === action.task.uuid) { + processor = 'cpu' + } + else if (state.runner.gpu.task.uuid === action.task.uuid) { + processor = 'gpu' + } else { + processor = null } return { ...state, @@ -184,10 +190,10 @@ const systemReducer = (state = systemInitialState, action) => { status: "disconnected", error: null, }, - runner: { + runner: processor ? { ...state.runner, - [action.task.processor]: { status: 'IDLE', task: {} }, - }, + [processor]: { status: 'IDLE', task: {} }, + } : state.runner, } case types.app.change_tool: return { -- cgit v1.2.3-70-g09d2