core: add new OnSuccess= dependency type
This is similar to OnFailure= but is activated whenever a unit returns into inactive state successfully. I was always afraid of adding this, since it effectively allows building loops and makes our engine Turing complete, but it pretty much already was it was just hidden. Given that we have per-unit ratelimits as well as an event loop global ratelimit I feel safe to add this finally, given it actually is useful. Fixes: #13386
This commit is contained in:
@@ -274,6 +274,8 @@ static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = {
|
||||
[UNIT_CONFLICTED_BY] = "ConflictedBy",
|
||||
[UNIT_BEFORE] = "Before",
|
||||
[UNIT_AFTER] = "After",
|
||||
[UNIT_ON_SUCCESS] = "OnSuccess",
|
||||
[UNIT_ON_SUCCESS_OF] = "OnSuccessOf",
|
||||
[UNIT_ON_FAILURE] = "OnFailure",
|
||||
[UNIT_ON_FAILURE_OF] = "OnFailureOf",
|
||||
[UNIT_TRIGGERS] = "Triggers",
|
||||
|
||||
@@ -227,7 +227,9 @@ typedef enum UnitDependency {
|
||||
UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */
|
||||
UNIT_AFTER,
|
||||
|
||||
/* On Failure */
|
||||
/* OnSuccess= + OnFailure= */
|
||||
UNIT_ON_SUCCESS,
|
||||
UNIT_ON_SUCCESS_OF,
|
||||
UNIT_ON_FAILURE,
|
||||
UNIT_ON_FAILURE_OF,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user