Skip to content

Conversation

juan518munoz
Copy link
Contributor

@juan518munoz juan518munoz commented Jul 21, 2025

The current implementation of our teardown function would use the initial state of the GenServer, intead of the last state retrieved from the main loop, this PR fixes that.

Note: with this solution we are only going through a teardown when everything works as expected, should we call the function with the initial state in case the init fails?

Copy link
Contributor

@fedacking fedacking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

with this solution we are only going through a teardown when everything works as expected, should we call the function with the initial state in case the init fails?

I don't think so, if init fails we may be in an inconsistent state, and the teardown function could be wrong.

};

handle.cancellation_token().cancel();
if let Err(err) = self.teardown(handle, state).await {
if let Err(err) = self.teardown(handle, final_state).await {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be run if main_loop fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still unsure as to if its "correct" or not to go through a teardown knowing that our state may be incorrect, maybe just going through this process in the happy case is right approach.

@juan518munoz
Copy link
Contributor Author

(Accidentally) solved by #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants