Reports transition to end state right away (vs on a timer)

This commit is contained in:
Taha Afzal authored and Michael Harding committed 2020-01-03 14:57:47 -05:00
1 parent 5ceeadf01e
commit a8d2df01ca
1 file changed
+9 -1
@@ -281,9 +281,17 @@ void SpreaderOrder::_switch_state (ISpreaderStateWorker* new_state){
key().value(),
(_state_worker == nullptr ? -1 : (int)_state_worker->state()),
(int)new_state->state());
bool to_end_state = new_state->state()==SpreaderState::END &&
(_state_worker == nullptr || _state_worker->state() != SpreaderState::END);
_state_worker = new_state;
_state_worker->on_transition();
_report_state();
if(to_end_state)
// if its going to the end state, report it right away
// (this is so top level algos can immediatly detect
// that the spreader is end state)
_comp_and_report_state();
else
_report_state();
}
void SpreaderOrder::_on_init_new(const bts::api::orderman::OrderDefinition& order_def,