all repos — honk @ 4a2eaddaf5dd2712c4a821c6b169d1f8fab27676

my fork of honk

more robust end of the world
Ted Unangst tedu@tedunangst.com
Tue, 18 Feb 2020 12:34:23 -0500
commit

4a2eaddaf5dd2712c4a821c6b169d1f8fab27676

parent

f01d31783a075c0e9cfeebb8a65d237f743d5ea1

1 files changed, 5 insertions(+), 10 deletions(-)

jump to
M web.goweb.go

@@ -983,6 +983,7 @@ func tracker() {

timeout := 4 * time.Minute sleeper := time.NewTimer(timeout) tracks := make(map[string][]string) + workinprogress++ for { select { case track := <-trackchan:

@@ -2245,25 +2246,19 @@ }

var endoftheworld = make(chan bool) var readyalready = make(chan bool) +var workinprogress = 0 func enditall() { sig := make(chan os.Signal) signal.Notify(sig, os.Interrupt) signal.Notify(sig, syscall.SIGTERM) <-sig - count := 0 log.Printf("stopping...") -sendloop: - for { - select { - case endoftheworld <- true: - count++ - default: - break sendloop - } + for i := 0; i < workinprogress; i++ { + endoftheworld <- true } log.Printf("waiting...") - for i := 0; i < count; i++ { + for i := 0; i < workinprogress; i++ { <-readyalready } log.Printf("apocalypse")