summary refs log tree commit diff stats
path: root/cmd
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-01-10 08:35:26 -0500
committerDrew DeVault <sir@cmpwn.com>2018-01-10 08:37:09 -0500
commit305446abfd66e85fe2c46cb4a07a3abb9fa809a4 (patch)
tree9cb8421a4f6a7efaa87d7bb3cbadc8d2ddf9e346 /cmd
parentb5d5e0dbedee34bd5d3edf13616f055d4f227d36 (diff)
downloadaerc-305446abfd66e85fe2c46cb4a07a3abb9fa809a4.tar.gz
Sleep main and worker loops on idle
Diffstat (limited to 'cmd')
-rw-r--r--cmd/aerc/main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/aerc/main.go b/cmd/aerc/main.go
index d5d0897..845d176 100644
--- a/cmd/aerc/main.go
+++ b/cmd/aerc/main.go
@@ -2,6 +2,7 @@ package main
 
 import (
 	"fmt"
+	"time"
 
 	"git.sr.ht/~sircmpwn/aerc2/config"
 	"git.sr.ht/~sircmpwn/aerc2/worker"
@@ -28,10 +29,15 @@ func main() {
 		workers = append(workers, work)
 	}
 	for {
+		activity := false
 		for _, worker := range workers {
 			if msg := worker.GetMessage(); msg != nil {
+				activity = true
 				fmt.Printf("<- %T\n", msg)
 			}
 		}
+		if !activity {
+			time.Sleep(100 * time.Millisecond)
+		}
 	}
 }