summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2021-12-03 12:29:39 +0000
committerPaul Buetow <pbuetow@mimecast.com>2021-12-03 12:29:39 +0000
commit9413bf8c8fe505db9e046fae12dad9951117e22d (patch)
tree4775ebdc0a113cf961cefb30d3bc8324b487f46b
parentdecb0434e84b34777d289f7f639e8d2363457417 (diff)
fix misuse of unbuffered channel for OS signal handling
-rw-r--r--Makefile3
-rw-r--r--cmd/dserver/main.go2
-rw-r--r--internal/io/signal/signal.go4
3 files changed, 5 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index a3b299c..680cef6 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,8 @@ vet:
echo ${GO} vet $$dir; \
${GO} vet $$dir; \
done
- grep -R TODO: .
+ sh -c 'grep -R NEXT: .'
+ sh -c 'grep -R TODO: .'
lint:
${GO} get golang.org/x/lint/golint
find . -type d | while read dir; do \
diff --git a/cmd/dserver/main.go b/cmd/dserver/main.go
index fff41f0..14188e1 100644
--- a/cmd/dserver/main.go
+++ b/cmd/dserver/main.go
@@ -55,7 +55,7 @@ func main() {
ctx, cancel = context.WithTimeout(ctx, time.Duration(shutdownAfter)*time.Second)
}
- sigCh := make(chan os.Signal)
+ sigCh := make(chan os.Signal, 10)
signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
go func() {
diff --git a/internal/io/signal/signal.go b/internal/io/signal/signal.go
index 584b59c..c01e82a 100644
--- a/internal/io/signal/signal.go
+++ b/internal/io/signal/signal.go
@@ -12,9 +12,9 @@ import (
// InterruptCh returns a channel for "please print stats" signalling.
func InterruptCh(ctx context.Context) <-chan string {
- sigIntCh := make(chan os.Signal)
+ sigIntCh := make(chan os.Signal, 10)
gosignal.Notify(sigIntCh, os.Interrupt)
- sigOtherCh := make(chan os.Signal)
+ sigOtherCh := make(chan os.Signal, 10)
gosignal.Notify(sigOtherCh, syscall.SIGHUP, syscall.SIGTERM, syscall.SIGQUIT)
statsCh := make(chan string)