Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <ahmad.m.sherif@gmail.com>2016-12-12 13:12:26 +0300
committerAhmad Sherif <ahmad.m.sherif@gmail.com>2016-12-12 13:12:26 +0300
commit29682e9670345e6b6a96e162f8ed10891ddf69ef (patch)
tree0ac12bb085034e776d9e2d360d7e1b080f7b7499
parentcb5fd2f078520f8750a4d8463a7336dd673d5fe1 (diff)
parent76972b7a84cf1bed8760a53bfecea8d2bf079b1a (diff)
Merge branch 'graceful-shutdown' into 'initial-server'
Graceful shutdown Make the server command to actually stop gracefully on SIGINT/TERM See merge request !6
-rw-r--r--cmd/server/main.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 18aca2f71..83aa5b558 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -1,9 +1,24 @@
package main
import (
+ "os"
+ "os/signal"
+ "syscall"
+
"gitlab.com/gitlab-org/git-access-daemon/server"
)
func main() {
- server.NewService().Serve("0.0.0.0:6666", server.CommandExecutorCallback)
+ ch := make(chan os.Signal)
+ signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
+
+ service := server.NewService()
+ go func() {
+ service.Serve("0.0.0.0:6666", server.CommandExecutorCallback)
+ }()
+
+ select {
+ case <-ch:
+ service.Stop()
+ }
}