Enhance BusinessRuleAsync execution with CanExecuteInParallel #3856
Unanswered
StefanOssendorf
asked this question in
Ideas
Replies: 1 comment 2 replies
-
This makes me think of some software I wrote around 1992 (give or take) to orchestrate the running of nightly batch processing jobs. Some jobs had to run one at a time, others could run in parallel. The jobs that ran one at a time were prioritized - some ran before the parallel jobs, some after and they all ran in a specific order. There was even a short-circuit idea, because if certain jobs failed then no other jobs should run after that point. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is probably something after #3736
Add a new property
public bool CanExecuteInParallel { get; protected set;} = true;
inBusinessRuleAsync
.With this flag the rule execution can be tweaked to disallow the exeuction of two async rules in parallel.
Currently, as far as I know, all async rules are executed in parallel regardles of priority or other constraints.
This would definitely slow down rule execution when used, but this is opt-in so the user should be aware of slower execution.
Use case:
At work we experienced sometimes EF core exceptions due to concurrent access of the DbContext. This happend after some performance tweaks and was tracked down to async rules which needed some info from the db.
We found two options to avoid this:
Both are so so and with the above proposed we could sequentialize rules which access a shared resource.
Opinions?
Beta Was this translation helpful? Give feedback.
All reactions