mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-10 12:57:54 +00:00
force flush of set_big log on shutdown
This commit is contained in:
parent
3c9a45a0a7
commit
1e7c2e6693
2 changed files with 8 additions and 3 deletions
10
core/http.go
10
core/http.go
|
|
@ -27,6 +27,7 @@ import (
|
|||
|
||||
type WebService struct {
|
||||
service *Service
|
||||
end chan bool
|
||||
}
|
||||
|
||||
func NewWebService(service *Service) *WebService {
|
||||
|
|
@ -137,7 +138,7 @@ func (self *WebService) Run() {
|
|||
port_string := strconv.Itoa(config.GetInt("port_http"))
|
||||
log.Printf("Serving HTTP on port %s...\n", port_string)
|
||||
logger_chan := make(chan []byte, 1024)
|
||||
end := make(chan bool)
|
||||
self.end = make(chan bool)
|
||||
flusher := make(chan bool)
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/message", self.HandleMessage)
|
||||
|
|
@ -161,9 +162,12 @@ func (self *WebService) Run() {
|
|||
Handler: mux,
|
||||
}
|
||||
id := config.GetString("id")
|
||||
go Logger(logger_chan, end, id, flusher)
|
||||
go Logger(logger_chan, self.end, id, flusher)
|
||||
s.ListenAndServe()
|
||||
end <- true
|
||||
}
|
||||
func (self *WebService) Shutdown() {
|
||||
self.end <- true
|
||||
|
||||
}
|
||||
|
||||
func (self *WebService) HandleMessage(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ func (service *Service) Run() {
|
|||
case <-sigterm:
|
||||
log.Println("SIGTERM! Cleaning up...")
|
||||
service.Index.Shutdown()
|
||||
service.WebService.Shutdown()
|
||||
util.ShutdownStats()
|
||||
service.Stop()
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue