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

Fatal flaw in Arisa's "catching up" logic #753

Open
violine1101 opened this issue Dec 4, 2021 · 4 comments
Open

Fatal flaw in Arisa's "catching up" logic #753

violine1101 opened this issue Dec 4, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@violine1101
Copy link
Member

The Bug

Arisa has a feature where it "catches up" on all recent things that happened on Mojira after a downtime. However I believe the way some modules are written, they have the incorrect assumption that all changes in the ticket happened after lastRun.

Now, Arisa goes through the tickets by "updated" value. This means that it'll only look at the tickets that were last updated during the last run. Some modules assume that all changes before the last run have already been checked. For example, CommandModule has a check so that it only checks commands that have been updated after the last run.

It appears not all modules are affected by this though; however I did encounter this while testing a new module that I'm in the process of writing.

Consider this timeline:

  • Arisa shuts off
  • A comment with a command gets left on ticket MC-1234
  • 20 minutes later, an attachment is added to the ticket
  • Arisa is started again
  • When Arisa sees the ticket, it won't act on the command comment because it's older than lastRun

To fix this, we'd need to store the time when we've seen the ticket for the last time, for every ticket. Not sure if that's worth it.

@violine1101 violine1101 added the bug Something isn't working label Dec 4, 2021
@SPGoding
Copy link
Member

SPGoding commented Dec 4, 2021

When Arisa sees the ticket, it won't act on the command comment because it's older than lastRun

I'm slightly confused. Shouldn't lastRun be a time before Arisa shuts down in this case, which means the command is going to be checked?

@violine1101
Copy link
Member Author

Ah yeah, important for this is that the catching up happens in 10 minute intervals, meaning that Arisa will query the first 10 minutes of the downtime, then execute the modules on the returned tickets, then update last run, and then continue on with the next 10 minutes.
I guess changing that logic would be an easier solution, or splitting last run into "last run where bot was caught up" and "last run in total".

@NeunEinser
Copy link
Member

I believe back when I worked with Arisa, there were no intervals. It probably was changed to not spam the tracker with requests or something?
In any case, last run should only be updated after all intervals have been successfully executed then, as that's what was the case when these modules were written and when I introduced lastRun.

@urielsalis
Copy link
Member

+1 to only updating lastRun after catching up with all tickets
And I think storing the last time we seen each ticket is not a bad approach either, if we use a proper embedded DB for it (which I wanted to do for a while to move lastRun and similar there) it should be only 3mb for all tickets in the MC project. Make it store only a run number instead of a full timestamp and its even less

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

4 participants