Skip to content
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

fix: slacktest GetSeenOutboundMessages race condition #1362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

askreet
Copy link

@askreet askreet commented Dec 13, 2024

This patch addresses issue #1361.

The storage backing GetSeenOutboundMessages is updated in a goroutine that may or may not be executed in time for assertions against this method. This patch updates the storage to be updated synchronously in the handler, while maintaining the asynchronous queue behavior for websockets handlers.

The test case has been updated to remove the sleep statement that likely worked around this very issue.

I opted to change the locking behavior to be more closely related with the messageCollection type. There is a smaller version of this fix that move the lock/update/unlock block into the callsite of each queue update, if that is preferable.

This patch addresses issue slack-go#1361.

The storage backing GetSeenOutboundMessages is updated in a goroutine
that may or may not be executed in time for assertions against this
method. This patch updates the storage to be updated synchronously in
the handler, while maintaining the asynchronous queue behavior for
websockets handlers.

The test case has been updated to remove the sleep statement that likely
worked around this very issue.

I opted to change the locking behavior to be more closely related with
the messageCollection type. There is a smaller version of this fix that
move the lock/update/unlock block into the callsite of each queue
update, if that is preferable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant