Skip to content
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

VersionError during cron should not cause cron to halt / crash #11059

Open
Alys opened this issue Mar 10, 2019 · 1 comment
Open

VersionError during cron should not cause cron to halt / crash #11059

Alys opened this issue Mar 10, 2019 · 1 comment

Comments

@Alys
Copy link
Contributor

Alys commented Mar 10, 2019

As described at #10806 (comment) and in #10711, if a VersionError occurs while cron is processing Dailies or Habits, cron will stop prematurely.

That should not happen. Cron should either:

  • ignore the error (leave the Daily unprocessed) and continue with the other Dailies and other kinds of actions
  • repeat its handling of that Daily, and then continue on to all other Dailies and other kinds of actions.

I'll leave this as suggestion-discussion for a few days in case staff have any comments and then mark it as help wanted.

@paglias
Copy link
Contributor

paglias commented Jul 14, 2020

With PR #12335 the Habitica codebase has been updated to support MongoDB 4.2 and transactions making it possible to fix this issue.

Transactions allow operations on multiple documents to be executed ensuring that either all of them are executed correctly or none, making it possible to fix this issue.

An example on using transactions can be found at https://mongoosejs.com/docs/transactions.html while more info at https://docs.mongodb.com/manual/core/transactions/. If you want to work on this issue and have any question please leave a comment!


This may be fixed by using transactions and wrapping everything that happens at cron in a transaction but we should make sure that if cron gets completely reverted the website and apps will give the user another chance to cron without the RYA model being shown twice. Also given how many parts of the code cron touches it might require a very big refactoring to use transactions when scoring tasks, ...

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

No branches or pull requests

5 participants