-
Notifications
You must be signed in to change notification settings - Fork 927
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
Add optimized supplier of current HTTP timestamp #2196
Conversation
481b46a
to
8a245bd
Compare
public Instant get() { | ||
return Instant.now(); | ||
public String get() { | ||
return HttpTimestampSupplier.currentTime(); |
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.
Perhaps we could remove this class and just use HttpTimestampSupplier::currentTime
?
Codecov Report
@@ Coverage Diff @@
## master #2196 +/- ##
============================================
- Coverage 73.61% 73.61% -0.01%
- Complexity 9590 9591 +1
============================================
Files 837 838 +1
Lines 36936 36944 +8
Branches 4553 4554 +1
============================================
+ Hits 27190 27195 +5
- Misses 7420 7426 +6
+ Partials 2326 2323 -3
Continue to review full report at Codecov.
|
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.
👍
newHeaders.add(HttpHeaderNames.DATE, | ||
DateTimeFormatter.RFC_1123_DATE_TIME.format( | ||
ZonedDateTime.now(ZoneOffset.UTC))); | ||
newHeaders.add(HttpHeaderNames.DATE, HttpTimestampSupplier.currentTime()); |
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.
Thanks! /cc @jyblue
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.
Thank you @anuraaga
This PR gave me a good education 👍
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.
👍
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, @anuraaga
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.
muy bueno
As TechEmpower suggests, this caches HTTP timestamps for any given second. I can wire this into the `Date` header after that's in if this makes sense :) ``` Benchmark Mode Cnt Score Error Units HttpTimestampSupplierBenchmark.cached thrpt 5 37665728.115 ▒ 324874.523 ops/s HttpTimestampSupplierBenchmark.notCached thrpt 5 2099035.297 ▒ 1176888.041 ops/s ```
As TechEmpower suggests, this caches HTTP timestamps for any given second. I can wire this into the
Date
header after that's in if this makes sense :)