Skip to content

Commit

Permalink
only
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-pi-miao committed Mar 2, 2019
1 parent 518a6c1 commit 06086a6
Show file tree
Hide file tree
Showing 161 changed files with 569 additions and 49,873 deletions.
138 changes: 0 additions & 138 deletions README.md

This file was deleted.

12 changes: 0 additions & 12 deletions logcatlog/20190302_18_20_37.log

This file was deleted.

7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package main

import (
"quick/router"
"flag"
_ "net/http/pprof"
"quick/initialize"
"flag"
"quick/router"
)


func main(){
func main() {
conf := *flag.String("f", "./config/config.toml", "config file")
flag.Parse()
initialize.Initialize(conf)
Expand Down
21 changes: 19 additions & 2 deletions router/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func Intranet(wg *sync.WaitGroup) {
}
exit := make(chan os.Signal)
signal.Notify(exit, syscall.SIGINT, syscall.SIGTERM)
go shutdown(exit, wg, srv, inDomain)
go intranetshutdown(exit, wg, srv, inDomain)
log.Debug("the Intranet http server run localhost:6060")
config.Log.Debug("[%s] the Intranet http server run localhost:6060", time.Now())
srv.ListenAndServe()
Expand All @@ -73,6 +73,23 @@ func shutdown(exit chan os.Signal, wg *sync.WaitGroup, srv *http.Server, domain
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(config.M.OldGateway.TimeOut)*time.Second)
defer func() {
cancel()
wg.Done()
}()
log.Warn(" gracefully shutdown the http server %s", domain)
err := srv.Shutdown(ctx)
if err != nil {
config.Log.Error("http server %v shutdown err:%v", domain, err)
return
}
}

func intranetshutdown(exit chan os.Signal, wg *sync.WaitGroup, srv *http.Server, domain string) {
<-exit
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(config.M.OldGateway.TimeOut)*time.Second)
defer func() {
cancel()
close(config.InsertChan)
close(config.DeleteChan)
close(config.ServiceChan)
close(config.ManagerChan)
wg.Done()
Expand All @@ -83,4 +100,4 @@ func shutdown(exit chan os.Signal, wg *sync.WaitGroup, srv *http.Server, domain
config.Log.Error("http server %v shutdown err:%v", domain, err)
return
}
}
}
24 changes: 24 additions & 0 deletions vendor/github.com/DeanThompson/syncmap/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/github.com/DeanThompson/syncmap/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions vendor/github.com/DeanThompson/syncmap/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions vendor/github.com/DeanThompson/syncmap/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 06086a6

Please sign in to comment.