Conversation
| ): Promise<SDKError> => { | ||
| if (e instanceof SDKError) { | ||
| e.step = e.step ?? step | ||
| e.process = e.process ?? process |
There was a problem hiding this comment.
Previously all the passed processes were the latest processes. Now we store them on execution level.
For debugging, one can take current step.execution.type and find a corresponding action by type.
Therefore passing down the action is excessive.
| export type ExecutionUpdate = Partial<Omit<Execution, 'type' | 'status'>> & { | ||
| type: StepExecutionType | ||
| status: ExecutionStatus | ||
| action?: ExecutionAction |
There was a problem hiding this comment.
Passing action is like findOrCreateProcess or updateProcess in the past - it adds a new action if it is not in the array yet, or overwrites specified fields of the existing action (without resetting unspecified ones).
| txLink: | ||
| statusReceiving?.txLink || | ||
| `${toChain.metamask.blockExplorerUrls[0]}tx/${statusReceiving?.txHash}`, | ||
| isDone: true, |
There was a problem hiding this comment.
isDone: true corresponds to setting process status as "DONE" in the previous implementation.
| // Change status to PENDING after resuming from FAILED | ||
| if (step.execution.status === 'FAILED') { | ||
| step.execution.startedAt = Date.now() | ||
| step.execution.status = 'PENDING' |
There was a problem hiding this comment.
for failed status, process was also set to empty array in prepareRestart
| ) | ||
|
|
||
| if (isBridgeExecution) { | ||
| process = this.statusManager.updateProcess(step, process.type, 'DONE') |
There was a problem hiding this comment.
Now execution can be "DONE" only in the very end. The intermediary "DONE" processes are marked as isDone: true in actions.
|
The changes are partially applied here: #345 |
Which Jira task is linked to this PR?
https://lifi.atlassian.net/browse/LF-17289
To test with widget: lifinance/widget#647
Why was it implemented this way?
This PR updates
StatusManagerwith simplified execution tracking:processarray becomesactionsarrayactionsstore types and metadata, but no statuses (except isDone)executionstores current process type, status, etc.Checklist before requesting a review