-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor 'autorun' handling into a loop (from recursion) #110
Conversation
Very long workflows can cause deep stacks; OpenXPKI is experiencing negative effects from this. However, in fact the situation is that 'autorun' can just as easily be handled with a loop. This change factors most of 'execute_action' into the private function '_execute_single_action' and incorporates '_auto_execute_state' into 'execute_action', which is now a loop which runs as long as the autorun requirements are satisfied.
@oliwel remarks on Slack that we may need to mark this |
While OpenXPKI depends on the fact that each executed step (including the autorun steps) is executed using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, more testing is possibly required
$self->_factory()->save_workflow($self); | ||
|
||
# If using a DBI persister with no autocommit, commit here. | ||
$self->_factory()->_commit_transaction($self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been wondering since this refactoring: shouldn't there be an observer message which the persister can hook into in order to commit its transaction?
); | ||
$self->state($old_state); | ||
|
||
$self->_factory()->_rollback_transaction($self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, but notify the failure?
lib/Workflow.pm
Outdated
@@ -377,6 +378,30 @@ sub _get_next_state { | |||
return $wf_state->get_next_state( $action_name, $action_return ); | |||
} | |||
|
|||
sub _auto_execute_state { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll submit a follow-up PR: This function was modified on the branch you merged in, but removed on the PR. The modified version is - just as the original - irrelevant after the changes in the PR. I'll follow up with a PR to remove this function.
Description
Very long workflows can cause deep stacks; OpenXPKI is experiencing
negative effects from this. However, in fact the situation is that
'autorun' can just as easily be handled with a loop.
This change factors most of 'execute_action' into the private function
'_execute_single_action' and incorporates '_auto_execute_state' into
'execute_action', which is now a loop which runs as long as the autorun
requirements are satisfied.
Fixes/addresses (If applicable) # (issue)
Type of change
Please delete options that are not relevant.
Checklist: