Try to make send_notifications more reliable#12160
Merged
oliverguenther merged 5 commits intodevfrom Feb 28, 2023
Merged
Conversation
This makes both `#active?` / `#active=` methods and `#already_set?` / `#already_set=` methods symmetrical. Before it was confusing to have `#active` return a Concurrent::ThreadLocalVar instance while `#active=` should be a boolean (asymmetrical value types).
This makes rubocop happier
Member
Author
|
I think this addresses the comments I had in #12147. Things that could be considered:
But I'm afraid of going down a rabbit hole if I try to do any of the above propositions. |
When calling a service with `send_notifications: false`, the `Journal::NotificationConfiguration.active?` will be set to `false` and subsequent calls to set it to `true` will have no effect and log a warning. For this reason, it's better to use `nil` as default value for `send_notifications` so that `Journal::NotificationConfiguration.active?` is changed only when the value is explicitly `true` or `false`, and ignored when the value is `nil`.
d7aa5aa to
a06e519
Compare
oliverguenther
approved these changes
Feb 28, 2023
Member
oliverguenther
left a comment
There was a problem hiding this comment.
Looking a lot better already. Thanks 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is a follow-up of #12147 where some comments where made about how the
send_notificationswas used and forwarded to services.