I noticed that when I create a new group, despite joining the group automatically upon creation, the members count for the group is not incremented.
I believe this is because a race condition exists in hook_nodeapi(). If OG fires first, that means that og_save_subscription() is fired off, which means that og_statistics_add_user() will be hit before og_statistics_write_record() is.
Working on a patch now..
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | og_statistics-fix-race-condition-on-group-creation-1162902.patch | 2.15 KB | mstef |
| #1 | og_statistics-fix-race-condition-on-group-creation-1162902.patch | 2.39 KB | mstef |
Comments
Comment #1
mstef commentedpatch
Comment #2
mstef commentedComment #3
dawehnerIt would be cool if you could write a test for this edge case.
Comment #4
mstef commentedEdge case? It happens every single time I add a new group. As long as og_nodeapi() fires before og_statistics_nodeapi() it will happen.
Comment #5
mstef commentedEither a solution like this, or weighting this module in the system table to act after OG are the only options.
Comment #6
dawehnerCall it how you want it.... but a test would still be cool
Comment #7
mstef commentedRepatched against what's in git now, if needed.
Comment #8
dawehnerOnce big reason for a simpletest is that the bug will never appear again.
Comment #9
mstef commentedI wasn't saying a test wasn't needed. I was just saying that I didn't see it as an edge case.
Comment #10
dawehnerIn general i seem to be somehow rude. I really don't wanted to be rude, but i'm in a kind of rush so please forgive me.
Comment #11
mstef commentedHa I don't think you're rude. You sound like me when I'm busy.
I can't write a test right now. I know for sure this is happening every time I create a group. Even if it is an edge case, it's clearly an issue.
What else can I do?
Comment #12
soulfroysPlease, was the last patch committed?
Comment #13
dawehnerNo, see status.
Comment #14
soulfroysI ask too early, sorry.