Skip to content

Using outdated counts when running counter_culture_fix_counts? #24

Open
@magnusvk

Description

counter_culture_fix_counts first loads all the correct counts into memory, then iterates over all instances and compares counts. Now, if in between loading the correct counts and comparing them in the loop, new children were created or destroyed, this count will be off and reset to an incorrect, outdated value.

Maybe we can use an update_all with a JOIN to let the database handle this atomically? Might this also be faster?

We could also put the fetching of each correct count and the corresponding update into a transaction, but then that would slow the whole process way down.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions