Merged
Conversation
… it does not affect compatibility with other implementations of the client class
jeromepl
approved these changes
Aug 6, 2025
lib/potlock/client.rb
Outdated
Comment on lines
32
to
33
| value = lock!(&block) | ||
| redis.set(key, value) | ||
| store_value!(value) |
There was a problem hiding this comment.
Isn't it weird that the redis.set call is not inside the lock! block? This feels like a bug of the gem 🤔 It looks like it should be
Suggested change
| value = lock!(&block) | |
| redis.set(key, value) | |
| store_value!(value) | |
| lock! do | |
| value = block.call | |
| store_value!(value) | |
| end |
Otherwise, I think it would be technically possible that a process that started later than another ends up storing its value in Redis first, so it would be overwritten by the first process.
Contributor
Author
There was a problem hiding this comment.
Agree, good catch
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.
CINT Oauth2 authentication flow does not use a
refresh_tokenlogic - instead they expect the clients to request a newauthorization tokenwhen is expired.This was validated with the CINT official documentation and the response from the authorization endpoint.
For this particular case we need to add expiration support for tokens stored using this library.- Addedexpires_inargument to the constructor - This is an optional value- Added default value toexpires_in- default valuenil- The expires time will be only added to thekeyif the argument is present - otherwise it will use the default expiration time- This change does not break previous implementationsWhat is left in this PR are the gem updates and a couple rubocop fixes