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

refactor(send): Add context.Context to parameter list of Send method #51

Merged
merged 5 commits into from
Feb 23, 2021

Conversation

nikoksr
Copy link
Owner

@nikoksr nikoksr commented Feb 18, 2021

Info

This closes #49. I added context.Context to the parameter list to all implementations and definitions of the Send method. This will allow users to cancel long running calls of said function.

Suggested changes

  • Add context.Context to parameter list of Send method
  • Update tests
  • Update documentation

Additional context

I need feedback for this! I added some TODO comments here and there.

In some cases the external library does not accept a context.Context itself and we don't loop over receivers but pass them all at once. This makes it hard for me to decide how to handle the context correctly. Do we check context.Context.IsDone at the beginning of a Send implementation, do we check it right before actually sending the message payload to the external service?

@nikoksr nikoksr added the type/feature New feature or request label Feb 18, 2021
@nikoksr nikoksr added the help wanted Extra attention is needed label Feb 18, 2021
@nikoksr nikoksr changed the title refactor(send): Add context.Context to parameter list of Send method WIP refactor(send): Add context.Context to parameter list of Send method Feb 18, 2021
@nikoksr nikoksr changed the title WIP refactor(send): Add context.Context to parameter list of Send method [WIP] refactor(send): Add context.Context to parameter list of Send method Feb 18, 2021
@nikoksr nikoksr mentioned this pull request Feb 18, 2021
5 tasks
@nikoksr
Copy link
Owner Author

nikoksr commented Feb 22, 2021

@checkaayush could you give this a quick review?

Copy link
Contributor

@checkaayush checkaayush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a minor typo fix suggested.

service/whatsapp/whatsapp.go Outdated Show resolved Hide resolved
@nikoksr nikoksr changed the title [WIP] refactor(send): Add context.Context to parameter list of Send method refactor(send): Add context.Context to parameter list of Send method Feb 23, 2021
@nikoksr nikoksr merged commit 5196bb2 into main Feb 23, 2021
@nikoksr nikoksr deleted the refactor/add-context-to-send branch February 23, 2021 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed size/L type/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor(send): Add context.Context to notify.Send method
2 participants