Uploaded image for project: 'Archive of Our Own'
  1. AO3-5172

Excessive calls to Tag.reset_filter_count in Tag.remove_filter_taggings

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Medium
    • Resolution: DeployedToBeta
    • Affects versions: 0.9.202
    • Fix versions: 0.9.219
    • Required Access Level:
      Tag Wrangler
    • Milestone:
      Internal 0.9
    • Difficulty:
      Medium
    • Roadmap:
      Tag Wrangling
    • Components:
      BackEnd

      Description

      Tag.remove_filter_taggings contains too many calls to Tag.reset_filter_count – one for each FilterTagging that gets deleted. Since each call to reset_filter_count forces the database to count all visible works in the filter (which requires a join between two tables, and conditions on both), I believe this results in runtime quadratic in the number of works in the tag. It would be better to keep it linear, and only call reset_filter_count once per filter.

      This is more of a runtime change than a functionality change, but to verify that the pull request hasn't completely stripped out the ability to fix the filter counts when wrangling, I believe this test will work:

      1. Pick two small fandom tags, one canonical, one non-canonical.
      2. Count the number of works in both tags.
      3. Syn the non-canonical fandom to the canonical fandom.
      4. Verify that when you view the canonical fandom on the Fandoms page, the number listed beside the fandom has changed. (You may have to wait a few minutes.)
      5. De-syn the non-canonical fandom.
      6. Verify that when you view the canonical fandom on the Fandoms page, the number listed beside the fandom has gone back down. (You may have to wait a few minutes.)

      (And of course, AO3-3830 To Do and AO3-4965 In Review mean you might have to try a few times to get wrangling to stick.)

        Attachments

          Activity

            People

            • Assignee:
              tickinginstant ticking instant
              Reporter:
              tickinginstant ticking instant
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: