mirror of
https://github.com/americanexpress/baton.git
synced 2025-07-06 04:12:29 +00:00
Avoid doing the division in the hot path
This commit is contained in:
parent
06a5b867fa
commit
a16f6402bf
@ -64,7 +64,7 @@ func (worker *worker) performRequest(req *fasthttp.Request, resp *fasthttp.Respo
|
|||||||
}
|
}
|
||||||
timeAfter := time.Now().UnixNano()
|
timeAfter := time.Now().UnixNano()
|
||||||
|
|
||||||
i := int((timeAfter - timeNow) / 1000)
|
i := int(timeAfter - timeNow)
|
||||||
// The select is needed to avoid blocking the thread
|
// The select is needed to avoid blocking the thread
|
||||||
// if the channel is full
|
// if the channel is full
|
||||||
select {
|
select {
|
||||||
@ -120,6 +120,7 @@ func (worker *worker) collectStatistics() {
|
|||||||
sum, total := int64(0), 0
|
sum, total := int64(0), 0
|
||||||
|
|
||||||
for timing := range worker.timings {
|
for timing := range worker.timings {
|
||||||
|
timing = timing / 1000
|
||||||
// The first request is associated with overhead
|
// The first request is associated with overhead
|
||||||
// in setting up the client so we ignore it's result
|
// in setting up the client so we ignore it's result
|
||||||
if first {
|
if first {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user