Skip to content

Conversation

davseby
Copy link
Contributor

@davseby davseby commented Dec 28, 2023

Problem

Running tests with race flag, you may get these errors:

Previous read at 0x00c0015a6628 by goroutine 106:
https://github.com/tucnak/telebot/blob/v3/api.go#L39

Write at 0x00c0015a6628 by main goroutine:
https://github.com/tucnak/telebot/blob/v3/bot.go#L205

Solution

Use a mutex to manage stopClient channel.

Note: Kinda a duplicate of #625, however it ensures that multiple stops or starts doesn't cause race issues.

@demget
Copy link
Collaborator

demget commented Dec 28, 2023

Looks much better than #625, thank you. This is going to be merged.

@demget demget added this to the v3.3 milestone Dec 28, 2023
@demget demget merged commit 4cce303 into tucnak:v3 Feb 20, 2024
@demget
Copy link
Collaborator

demget commented Feb 20, 2024

@davseby am I right that your changes should fix #584?

@davseby
Copy link
Contributor Author

davseby commented Feb 21, 2024

@davseby am I right that your changes should fix #584?

Hi @demget, yes, it's supposed to.

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.

2 participants