mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-10 03:40:24 +08:00
优化代码
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user