https://github.com/valyala/fasthttp/blob/master/coarseTime.go#L22
t := time.Now().Truncate(time.Second)
When this line runs in a goroutine it reads time.Local with time.Now(). Because goroutine starts from init() external application has a very limited control over public and exported time.Local.
This simple code would trigger race condition
func main() {
time.Local = time.UTC
// continue app initialization
}
It is not clear why @valyala introduced this coarse time. Benchmarks on
different systems show that the speedup is no where enough to justify
the added code complexity.
See: https://github.com/erikdubbelboer/fasthttp/commit/033e10c58522144bd570ff3aa45fbd2f3df917db (this is a fork I maintain until @valyala starts maintaining this project again)
fixed, but useful note: do not change time.Location. This variable should be the system's timezone, not your service's one. you should probably change system timezone instead of overwriting global variables.
Most helpful comment
It is not clear why @valyala introduced this coarse time. Benchmarks on
different systems show that the speedup is no where enough to justify
the added code complexity.
See: https://github.com/erikdubbelboer/fasthttp/commit/033e10c58522144bd570ff3aa45fbd2f3df917db (this is a fork I maintain until @valyala starts maintaining this project again)