-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add note about why there is a seemingly superfluous check for whether the member is part of the guild #201
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check can be moved even sooner, to line 87.
I don't think it can? cos you'd be saying loop over the members in the guild then check if the member is in the guild wouldn't you? |
Yh, it seems stupid. But I think there's something wrong with the caching from pycord here. Because surely the logic of "we're looping through the guild members" holds true even further down in the condition checks? How can the member be part of the main guild at line 87, but suddenly not at line 127? |
I would suggest that if we think there's a possibility that the user is leaving the server between the start and the checks, the. The "is in guild" check should be as close to the action to be taken as possible. If it is a caching issue, moving this check higher leaves a greater gap for the user to leave before we want to send them a message. |
yeah there's definitely something funky going on - my guess was something along the lines of yeah it's doing the loop, then before it gets to person xyz they've already left but idk |
counter proposal: every single line of this method should just check if the user is in the guild over and over again /s |
I reckon bin this for now, we'll see if the new induction check stuff helps and if not we can reconsider this |
If this is currently our best guess, I think we have the greatest chance of success by keeping the check closer. Sure it hurts performance a tiny bit in some cases as extra checks are performed despite this one later failing, but if rather that than open the door to random It might be worthwhile, rather than moving the check further away, just adding a note comment explaining why this check is there and why it's in that location # NOTE: blah blah blah. |
Puts the check to make sure the user is in the guild to be the very first check as this supersedes all others because if they're not in the server there's no point checking anything else.