-
Notifications
You must be signed in to change notification settings - Fork 31
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
rsa10k cache server time offset #95
Conversation
ably/auth.go
Outdated
//Timestamp returns the timestamp to be used in authorization request. | ||
func (a *Auth) Timestamp(query bool) (time.Time, error) { | ||
var now time.Time | ||
if a.Now != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand this. It looks to me like you've declared Auth:Now()
. So what does this test do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paddybyers Now
is a helper in case the user wants to supply the time function. The reason behind this is to allow me to write better test coverage of the caching feature. This function allows us to set default values in case Now
is not supplied. Please see the tests, I think I wouldn't have been able to make them that way without this.
I didn't want to use real clock, also I was avoiding client.Time()
call because that is testsed somewhere else so not relevant here. The most important bit is caching and calculating time based on cached duration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now
is a helper in case the user wants to supply the time function
Isn't there a way to add that without making it part of the public API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
No description provided.