Commit c43106a9 authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Fix do not use local process for starting methods

parent 63725029
......@@ -112,49 +112,39 @@ export class RunningProcessService implements ElementService<RunningProcess> {
/**
* Start the execution of a method
*
* @param runningProcess the running process
* @param runningProcessId the id of the running process
* @param nodeId the id of the node to execute
*/
async startMethodExecution(runningProcess: RunningProcess, nodeId: string) {
const databaseProcess = await this.get(runningProcess._id);
if (databaseProcess._rev !== runningProcess._rev) {
throw new Error(
'Reload needed, process in database does not fit current process'
);
}
async startMethodExecution(runningProcessId: string, nodeId: string) {
const databaseProcess = await this.get(runningProcessId);
if (
!(await this.processExecutionService.canExecuteNode(
runningProcess,
databaseProcess,
nodeId
))
) {
throw new Error('Can not execute node');
}
this.methodExecutionService.startMethodExecution(runningProcess, nodeId);
return this.saveRunningProcess(runningProcess);
this.methodExecutionService.startMethodExecution(databaseProcess, nodeId);
return this.saveRunningProcess(databaseProcess);
}
/**
* Start the execution of a todomethod
*
* @param runningProcess the running process
* @param runningProcessId the id of the running process
* @param executionId the execution id of the todomethod
*/
async startTodoMethodExecution(
runningProcess: RunningProcess,
runningProcessId: string,
executionId: string
) {
const databaseProcess = await this.get(runningProcess._id);
if (databaseProcess._rev !== runningProcess._rev) {
throw new Error(
'Reload needed, process in database does not fit current process'
);
}
const databaseProcess = await this.get(runningProcessId);
this.methodExecutionService.startTodoMethodExecution(
runningProcess,
databaseProcess,
executionId
);
return this.saveRunningProcess(runningProcess);
return this.saveRunningProcess(databaseProcess);
}
/**
......
......@@ -221,14 +221,14 @@ export class RunningProcessComponent implements OnInit {
async startNodeExecution(nodeId: string) {
await this.runningProcessService.startMethodExecution(
this.runningProcess,
this.runningProcess._id,
nodeId
);
}
async startExecution(executionId: string) {
await this.runningProcessService.startTodoMethodExecution(
this.runningProcess,
this.runningProcess._id,
executionId
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment