-
Notifications
You must be signed in to change notification settings - Fork 210
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
Using outdated counts when running counter_culture_fix_counts? #24
Comments
This problem is much reduced with a927a23; that commit makes sure we pull both the correct and incorrect counts in one query. However, any additions / deletions between then and the later update would still cause a disparity. In any case, we are certainly better off. |
Would changing it to do an update_all with a JOIN help out with #79 at all? Even though that issue was closed, it is actually still a pressing issue for me and I haven't found a suitible solution yet. |
@xtagon I'm not sure what you mean to be honest. |
@magnusvk I was hoping this meant |
@magnusvk Yes it does, but it does 1 In the end I was able to do a single |
Great, glad you could get it resolved. :) |
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.
The text was updated successfully, but these errors were encountered: