Repository navigation
Conversation
WilliamRoebuck
left a comment
There was a problem hiding this comment.
I like removing the error before/after ready distinction, that part was always quite confusing to me. Unfortunately though, a lot of the new changes have just become out of date yesterday since #738.
In summary, the whole async issue is no longer present, kWaiting can probably be removed. As far as I know:
tryReportCompletionis no longer needed. Existing calls should be replaced or removedtryHandleTermination- should now only flag an error to the caller or return some sort of void/ignore result (no error yet). Should never returnkSuccess. Terminations during startup are resolved at the end using the stored termination result member.activate&deactivate- always runs synchronously and returns success or failure
This all probably allows process monitor to be simplified as well
There are also some leftover unit tests (several of the parameterized ones) that test various async termination scenarios, most of which can be removed.
This is good to hear. I think most of the dead code will be replaced anyway as part of #705, so in this pull request I'll only make the minimal edits needed to change the error types. |
|
@WilliamRoebuck I've removed the async values from the enums. I'd appreciate if you could take another look :)) |
The old result was difficult to understand because some values had multiple meanings, and different things were valid depending on the context. Split into two results, one for de/activate and one for termination. The interesting changes are in `icomponent.hpp`.
I only made the minimal edits in `ProcessInfoNode` to be able to update the enums: there is still a lot of code which does not really make sense any more. However, the new `Component` class shall eventually replace `ProcessInfoNode`, so there is not much point refactoring it further.
90a525a to
3d86568
Compare
|
Documentation preview for this pull request is available at: |
| { | ||
| run_target.activate(stop_source_.get_token()); | ||
| const IComponent::RequestResult result = run_target.activate(stop_source_.get_token()); | ||
| SCORE_LANGUAGE_FUTURECPP_ASSERT(result == IComponent::RequestResult::kSuccess); |
There was a problem hiding this comment.
Hmm I think it's right now safe to assert here because the run_target.activate just sets variable but not sure if we should assume that will be the case forever. I would rather log an error I think?
There was a problem hiding this comment.
Originally we just ignored the return value entirely. I think logging an error could have the same consequences (errors going unnoticed) - the log message might not be noticed if tests are passing.
I would prefer keeping the assert and adding proper error handling if/when the need arises
There was a problem hiding this comment.
I think the assert is good here because other changes might be needed if this did change, needs an assert message though to clear things up (e.g. "Run target activation cannot fail").
Also, is SCORE_LANGUAGE_FUTURECPP_ASSERT debug or production? Probably doesn't matter here but this seems ambiguous. Or did the API change?
There was a problem hiding this comment.
Also, is
SCORE_LANGUAGE_FUTURECPP_ASSERTdebug or production?
Neither...
| Compilation flag | ||||
| Default | Debug | Production | ||
| Assertion type |
Default | Yes | Yes | No |
| Debug | No | Yes | No | |
| Production | Yes | Yes | Yes | |
WilliamRoebuck
left a comment
There was a problem hiding this comment.
Looks great now, I only have two small suggestions
| IdentifierHash node_identifier; | ||
| /// @brief Description of the error. | ||
| IComponent::ComponentError reason; | ||
| /// @brief Why the activation failed, either kFailure or kTimeout. |
There was a problem hiding this comment.
I think RequestResult should still be an expected (expected_blank I think) with an error code. Something that can be kSuccess being an error code seems wrong to me.
| { | ||
| run_target.activate(stop_source_.get_token()); | ||
| const IComponent::RequestResult result = run_target.activate(stop_source_.get_token()); | ||
| SCORE_LANGUAGE_FUTURECPP_ASSERT(result == IComponent::RequestResult::kSuccess); |
There was a problem hiding this comment.
I think the assert is good here because other changes might be needed if this did change, needs an assert message though to clear things up (e.g. "Run target activation cannot fail").
Also, is SCORE_LANGUAGE_FUTURECPP_ASSERT debug or production? Probably doesn't matter here but this seems ambiguous. Or did the API change?
I struggled to understand the original code because some values had multiple meanings, and different things were valid depending on the context.
Split into two results, one for de/activate and one for termination. The interesting changes are in
icomponent.hpp.Part of addressing #705 (comment)