优化代码

This commit is contained in:
GoEdgeLab
2023-08-08 15:39:00 +08:00
parent 72c390fba5
commit 2a5aefe7f1
22 changed files with 27 additions and 53 deletions

View File

@@ -85,7 +85,7 @@ func (this *RateLimitWriter) write(p []byte) (n int, err error) {
this.written += n
if this.written >= this.rateBytes {
var duration = 1*time.Second - time.Now().Sub(this.before)
var duration = 1*time.Second - time.Since(this.before)
if duration > 0 {
time.Sleep(duration)
}