Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!kernel.id || !kernel.sessionId) {
return of(
actions.killKernelFailed({
error: new Error(
"websocket kernel epic can only kill websocket kernels with an id"
),
kernelRef: action.payload.kernelRef
})
);
}
// TODO: If this was a kernel language change, we shouldn't be using this
// kill kernel epic because we need to make sure that creation happens
// after deletion
return sessions.destroy(serverConfig, kernel.sessionId).pipe(
mergeMap(() =>
action.payload.dispose && action.payload.kernelRef
? of(
actions.killKernelSuccessful({
kernelRef: action.payload.kernelRef
}),
actions.disposeKernel({ kernelRef: action.payload.kernelRef })
)
: of(
actions.killKernelSuccessful({
kernelRef: action.payload.kernelRef
})
)
),
catchError(err =>
of(
if (kernel.type !== "websocket" || !kernel.id || !kernel.sessionId) {
return of(
actions.killKernelFailed({
error: new Error(
"websocket kernel epic can only kill websocket kernels with an id"
),
kernelRef: action.payload.kernelRef
})
);
}
// TODO: If this was a kernel language change, we shouldn't be using this
// kill kernel epic because we need to make sure that creation happens
// after deletion
return sessions.destroy(serverConfig, kernel.sessionId).pipe(
map(() =>
actions.killKernelSuccessful({
kernelRef: action.payload.kernelRef
})
),
catchError(err =>
of(
actions.killKernelFailed({
error: err,
kernelRef: action.payload.kernelRef
})
)
)
);
})
);