8000 Updating rule whilst rule handler running can corrupt state · Issue #1589 · jorenn92/Maintainerr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Updating rule whilst rule handler running can corrupt state #1589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
benscobie opened this issue Feb 20, 2025 · 0 comments
Open

Updating rule whilst rule handler running can corrupt state #1589

benscobie opened this issue Feb 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@benscobie
Copy link
Collaborator
benscobie commented Feb 20, 2025

Weird things can happen when updating or deleting rules whilst the rule handler is running. I've seen people having to nuke their Maintainerr data as we've managed to get into an invalid state.

When a rule is updated, if any of the following has happened, we delete the collection media and then the Plex collection. This is one of the main trouble areas:

  • Library changes
  • Media type changes
  • Manual collection settings changed

Couple of ideas to resolve:

  • Add checks in relevant places in the rule handler to verify if the rule still exists prior to any mutations.
  • Load all of the required data upfront and pass into rule handling. This would allow rule updates whilst handling is in progress as we won't be hitting the DB.
  • If the above is not possible, we could prompt to stop the rule handler when performing an update/delete (requires the below).
  • Add the ability to stop the rule handler from running. This should be pretty simple as I imagine most of the time is spent within executeRulesWithData, and nothing destructive happens in here. The only place we won't be able to stop is within handleCollection as that does mutate data. As an aside to this, we should enable lifecycle hooks in Nest.js so we can stop any in-progress tasks gracefully.

Related issues:

@benscobie benscobie added the bug Something isn't working label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant
0