1
mirror of https://github.com/rclone/rclone synced 2024-11-17 17:30:37 +01:00

Make it possible to disable stats printing with --stats=0

This commit is contained in:
Nick Craig-Wood 2015-02-27 15:22:26 +00:00
parent 85f8552c4d
commit e89ea3360e

View File

@ -28,7 +28,7 @@ import (
var ( var (
// Flags // Flags
cpuprofile = pflag.StringP("cpuprofile", "", "", "Write cpu profile to file") cpuprofile = pflag.StringP("cpuprofile", "", "", "Write cpu profile to file")
statsInterval = pflag.DurationP("stats", "", time.Minute*1, "Interval to print stats") statsInterval = pflag.DurationP("stats", "", time.Minute*1, "Interval to print stats (0 to disable)")
version = pflag.BoolP("version", "V", false, "Print the version number") version = pflag.BoolP("version", "V", false, "Print the version number")
) )
@ -323,6 +323,9 @@ func NewFs(remote string) fs.Fs {
// Print the stats every statsInterval // Print the stats every statsInterval
func StartStats() { func StartStats() {
if *statsInterval <= 0 {
return
}
go func() { go func() {
ch := time.Tick(*statsInterval) ch := time.Tick(*statsInterval)
for { for {