Skip to content

Commit

Permalink
Fix and optimize request rate wait time
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Damon committed Nov 15, 2018
1 parent ebc9ec8 commit a5dd590
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions cmd/logshare-cli/main.go
Expand Up @@ -119,15 +119,11 @@ func run(conf *config) func(c *cli.Context) error {
hourStart := conf.startTime
hourEnd := hourStart + 3600
var previousRequest time.Time
var requestGap time.Duration
for hourStart < conf.endTime {
if hourEnd > conf.endTime {
hourEnd = conf.endTime
}
requestGap = time.Since(previousRequest)
if requestGap.Seconds() < 5 {
time.Sleep(requestGap)
}
time.Sleep(5 * time.Second - time.Since(previousRequest))
previousRequest = time.Now()
meta, err = client.GetFromTimestamp(
conf.zoneID, hourStart, hourEnd, conf.count)
Expand Down

0 comments on commit a5dd590

Please sign in to comment.