diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-05 03:43:09 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-05 03:43:09 +0200 |
| commit | 4298d8d81c9bea0fb4c0f115dfa2b04ea72f0006 (patch) | |
| tree | 27ca33f462123757e541b4eef080d834e18ceb1d /app/client/system/system.reducer.js | |
| parent | 51d9212d97e3b326a8e9e6499bc83d27df2ef64c (diff) | |
kill cleanly
Diffstat (limited to 'app/client/system/system.reducer.js')
| -rw-r--r-- | app/client/system/system.reducer.js | 16 |
1 files changed, 11 insertions, 5 deletions
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 { |
