Fixing the lost of the initial state after a task recovery.
Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -196,7 +196,7 @@ describe('DatabaseTaskStore', () => {
|
||||
await store.claimTask();
|
||||
|
||||
const claimedTask = await store.getTask(taskId);
|
||||
expect(claimedTask.state).toEqual({ state });
|
||||
expect(claimedTask.state).toEqual({ state: state.state });
|
||||
});
|
||||
|
||||
it('should shutdown the running task', async () => {
|
||||
|
||||
@@ -212,7 +212,7 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
try {
|
||||
const spec = JSON.parse(result.spec);
|
||||
const secrets = result.secrets ? JSON.parse(result.secrets) : undefined;
|
||||
const state = result.state ? JSON.parse(result.state) : undefined;
|
||||
const state = result.state ? JSON.parse(result.state).state : undefined;
|
||||
return {
|
||||
id: result.id,
|
||||
spec,
|
||||
@@ -272,7 +272,7 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
|
||||
const getState = () => {
|
||||
try {
|
||||
return task.state ? JSON.parse(task.state) : undefined;
|
||||
return task.state ? JSON.parse(task.state).state : undefined;
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Failed to parse state of the task '${task.id}', ${error}`,
|
||||
|
||||
Reference in New Issue
Block a user