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..

Comments

mstef’s picture

mstef’s picture

Status: Active » Needs review
dawehner’s picture

It would be cool if you could write a test for this edge case.

mstef’s picture

Edge case? It happens every single time I add a new group. As long as og_nodeapi() fires before og_statistics_nodeapi() it will happen.

mstef’s picture

Either a solution like this, or weighting this module in the system table to act after OG are the only options.

dawehner’s picture

Call it how you want it.... but a test would still be cool

mstef’s picture

Repatched against what's in git now, if needed.

dawehner’s picture

Once big reason for a simpletest is that the bug will never appear again.

mstef’s picture

I wasn't saying a test wasn't needed. I was just saying that I didn't see it as an edge case.

dawehner’s picture

In 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.

mstef’s picture

Ha 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?

soulfroys’s picture

Please, was the last patch committed?

dawehner’s picture

No, see status.

soulfroys’s picture

I ask too early, sorry.