MAD icon indicating copy to clipboard operation
MAD copied to clipboard

Clear finished quests

Open crhbetz opened this issue 4 years ago • 9 comments

Review and testing required !!!

Related issue: #869

The recent event bringing a "spin 3 pokestops" quest highlighted the problem of handling finished quests during quest scan. While it's not usually a problem on pure scanner accounts, events and changes can severely impact scan performance by introducing quests a quest scanner unintentionally finishes before it's able to delete them.

The most stable way to handle this issue is usually to set cleanup_every_spin in area settings to True (or using quest enhancer addon). However, this negatively impacts scan performance in dense areas, because the time and resource heavy ocr routines have to run more frequently.

However, this PR attempts to handle finished quests as far as a scanning software is able to. It works as follows:

  1. If during quest ~~deletion~~ scan ~~less than the expected amount of trashcans is found~~ the quest log is unexpectedly full, a check for finished quests will follow.
  2. Using OCR, finished quests are identified by keyword
  3. Finished quests are categorized according to screen position and color tint (stack, retrieveable, blocked have slightly different tints of orange)
  4. Quests are handled accordingly - finished quests will be retrieved; when quests are blocked, it will be attempted to claim the weekly breakthrough and run. This will enable another 7 days of claiming quests
  5. If quests remain blocked, an error will be logged saying the breakthrough has to be caught

In the end, this PR results in - ideally - requiring manual intervention once every 14 days to retrieve weekly breakthroughs, instead of possibly every day to clear up individual finished quests. It'll also explicitly identify the issue in the logs instead of the workers failing without an explicit cause.

Notes:

  • ~~the change in mapadroid/ocr/matching_trash.py was necessary because quests blocked by the breakthrough were identified as having a trashcan - raising the threshold to 0.65 reliably fixed this without causing any false negatives~~ this has been reverted
  • successfully tested on a setup of >30 x96mini devices scanning > 2k quests daily. I achieved close to normal scanning performance despite the ongoing event with cleanup_every_spin set to False
  • ...with default settings regarding screenshot filetype, quality
  • I don't think it is necessary to make this feature optional as I can't see any negative impact - I'm open to other opinions on that, though
  • I consider further testing across different devices necessary

crhbetz avatar Oct 14 '20 11:10 crhbetz

Im working fine with cleanup_every_spin set to True - But sometimes the quest got solved anyway. Will your changes work as backup in this case and clean the solved quest?

TechG3n avatar Oct 15 '20 08:10 TechG3n

Im working fine with cleanup_every_spin set to True - But sometimes the quest got solved anyway. Will your changes work as backup in this case and clean the solved quest?

No this wont clean solved quests, but reduce the cases where quests are solved.

JimBim89 avatar Oct 15 '20 09:10 JimBim89

It will eventually. To run efficiently, the check for finding finished quests only happens if less trash cans than expected were found - that's less than one in the case of running cleanup every spin.

This means that it'll only clean quests for you if you have three (or less if a trash can can't be found for another reason). It should then clean them all in one go.

crhbetz avatar Oct 15 '20 09:10 crhbetz

Im working fine with cleanup_every_spin set to True - But sometimes the quest got solved anyway. Will your changes work as backup in this case and clean the solved quest?

No this wont clean solved quests, but reduce the cases where quests are solved.

This is all about clearing finished (=solved) quests (to the stack).

crhbetz avatar Oct 15 '20 09:10 crhbetz

Yeah I thought this was related to PR1029, will also test this ;)

JimBim89 avatar Oct 15 '20 09:10 JimBim89

This is now obviously conflicting with the new AR quest mess, specifically the changes coming with #1051.

I will have to reconsider this whole feature and check if the upcoming PogoDroid will even allow to do this. So put on hold for now.

crhbetz avatar Nov 01 '20 17:11 crhbetz

Reworked to check for finished quests on the initial startup, and when the quest log is unexpectedly full (Failed getting quest but got items).

Working on recent master with updated PD keeping an AR quest in inventory. Testing would now be welcome :-)

crhbetz avatar Nov 23 '20 11:11 crhbetz

Uhm this was left for ages I guess.... What's the state of the PR here?

Grennith avatar Jun 08 '21 04:06 Grennith

@Grennith been running this myself ever since I created the PR. I guess nobody cares anymore because we didn't get another "spin 3 pokestops" quest since then. It would still be relevant if this quest ever came back.

crhbetz avatar Aug 01 '21 13:08 crhbetz