From 305446abfd66e85fe2c46cb4a07a3abb9fa809a4 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 10 Jan 2018 08:35:26 -0500 Subject: Sleep main and worker loops on idle --- cmd/aerc/main.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd') 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) + } } } -- cgit v1.2.3