Skip to content

Commit abdf9a8

Browse files
committed
chore: rename method
1 parent ab76fb0 commit abdf9a8

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

lib/TaskExecution.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class TaskExecution extends EventEmitter {
3939
const eventBus = injector.get('eventBus');
4040

4141
eventBus.on([ 'selection.changed', 'commandStack.changed' ], () => {
42-
this._cleanUp();
42+
this.cancelTaskExecution();
4343
});
4444
}
4545

@@ -52,23 +52,23 @@ export default class TaskExecution extends EventEmitter {
5252
* @returns {Promise<void>}
5353
*/
5454
async executeTask(elementId, variables) {
55-
await this._cleanUp();
55+
await this.cancelTaskExecution();
5656

5757
this.emit('taskExecution.status.changed', 'deploying');
5858

5959
const deploymentResult = await this._api.deploy();
6060

6161
if (!deploymentResult.success) {
6262
this._emitError('Failed to deploy process definition', deploymentResult.error);
63-
this._cleanUp();
63+
this.cancelTaskExecution();
6464
return;
6565
}
6666

6767
const processId = getProcessId(deploymentResult.response);
6868

6969
if (!processId) {
7070
this._emitError('Failed to retrieve process ID from deployment response');
71-
this._cleanUp();
71+
this.cancelTaskExecution();
7272
return;
7373
}
7474

@@ -78,15 +78,15 @@ export default class TaskExecution extends EventEmitter {
7878

7979
if (!startInstanceResult.success) {
8080
this._emitError('Failed to start process instance', startInstanceResult.error);
81-
this._cleanUp();
81+
this.cancelTaskExecution();
8282
return;
8383
}
8484

8585
const processInstanceKey = getProcessInstanceKey(startInstanceResult.response);
8686

8787
if (!processInstanceKey) {
8888
this._emitError('Failed to retrieve process instance key from start instance response');
89-
this._cleanUp();
89+
this.cancelTaskExecution();
9090
return;
9191
}
9292

@@ -140,21 +140,19 @@ export default class TaskExecution extends EventEmitter {
140140
variables
141141
});
142142

143-
this._cleanUp();
143+
this.cancelTaskExecution();
144144
}
145145
};
146146

147147
this._interval = setInterval(intervalCallback, INTERVAL_MS);
148148
}
149149

150-
async cancelTaskExecution() {
151-
await this._cleanUp();
152-
}
153-
154150
/**
155-
* Clean up current task execution and emit `taskExecution.status.changed` with `idle`.
151+
* Cancel current task execution, clean up and emit events:
152+
* - `taskExecution.status.changed` with status `idle`
153+
* - `taskExecution.canceled`
156154
*/
157-
async _cleanUp() {
155+
async cancelTaskExecution() {
158156

159157
// TODO: Proper clean up:
160158
// - delete process instance

0 commit comments

Comments
 (0)