Skip to content

Conversation

eatkins
Copy link
Contributor

@eatkins eatkins commented Apr 9, 2022

This PR restores the watchOnTermination callback behavior to fix #6861. I assume that the regression occurred when I refactored watch to support the thin client but I didn't bother investigating the old behavior and just made the changes necessary to make the callbacks be invoked.

Fixes #6861

eatkins added 2 commits April 9, 2022 15:40
At some point the watchOnTermination callback stopped working. I'm not
exactly sure how or why that happened but it is fairly straightforward
to restore. The one tricky thing was that the callback has the signature
(Watch.Action, _, _, _) => State, which requires propagating the action
to the failWatch command. The easiest way to do this was to add a
mutable field to the ContinuousState. This is rather ugly and reflects
some poor design choices but a more comprehensive refactor is out of
the scope of this fix.

This commit adds a scripted test that ensures that the callback is
invoked both in the successful and unsuccessful watch cases. In each
case the callback deletes a file and we ensure that the file is indeed
absent after the watch exits.
@eatkins
Copy link
Contributor Author

eatkins commented Apr 9, 2022

The combined diff is a little ugly because I moved the original watch/on-termination test because it had a misleading name. The second commit is the important one.

@eatkins eatkins changed the title Watch on termination Restore watchOnTermination callbacks Apr 11, 2022
Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks!

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

Successfully merging this pull request may close these issues.

watchOnTermination setting not respected
2 participants