Browse code

Reduce debugf frequency to avoid terminal freeze

Guillaume J. Charmes authored on 2013/11/26 05:06:16
Showing 1 changed files
... ...
@@ -650,10 +650,13 @@ func (devices *DeviceSet) waitRemove(hash string) error {
650 650
 			// The error might actually be something else, but we can't differentiate.
651 651
 			return nil
652 652
 		}
653
-		utils.Debugf("Waiting for removal of %s: exists=%d", devname, devinfo.Exists)
653
+		if i%100 == 0 {
654
+			utils.Debugf("Waiting for removal of %s: exists=%d", devname, devinfo.Exists)
655
+		}
654 656
 		if devinfo.Exists == 0 {
655 657
 			break
656 658
 		}
659
+
657 660
 		time.Sleep(1 * time.Millisecond)
658 661
 	}
659 662
 	if i == 1000 {
... ...
@@ -676,7 +679,9 @@ func (devices *DeviceSet) waitClose(hash string) error {
676 676
 		if err != nil {
677 677
 			return err
678 678
 		}
679
-		utils.Debugf("Waiting for unmount of %s: opencount=%d", devname, devinfo.OpenCount)
679
+		if i%100 == 0 {
680
+			utils.Debugf("Waiting for unmount of %s: opencount=%d", devname, devinfo.OpenCount)
681
+		}
680 682
 		if devinfo.OpenCount == 0 {
681 683
 			break
682 684
 		}