summaryrefslogtreecommitdiff
path: root/src/hub/src/spreadspace.org/sfive/s5srv.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5srv.go')
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srv.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srv.go b/src/hub/src/spreadspace.org/sfive/s5srv.go
index 2a312bd..adfd2da 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srv.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srv.go
@@ -140,6 +140,11 @@ func (srv Server) Close() {
s5l.Printf("srv: shutting down")
close(srv.quit)
srv.done.Wait()
+ // TODO: shutdown procedure is flawed:
+ // - there might still be data in the ingest and ingestMany channels
+ // when issuing quit -> data loss!!
+ // - if interfaces ingets new data when ingest channels are alreday closed
+ // they produce a panic!!
close(srv.ingestChan)
close(srv.ingestManyChan)
@@ -148,7 +153,6 @@ func (srv Server) Close() {
}
func NewServer(cfg SrvConfig) (srv *Server, err error) {
- // TODO: read configuration and create instance with correct settings
srv = &Server{}
if srv.store, err = NewStore(cfg.Store); err != nil {
return
@@ -170,7 +174,10 @@ func NewServer(cfg SrvConfig) (srv *Server, err error) {
s5l.Printf("srv|xfrm: using Geo-IP Lookup: %s", srv.geoip)
}
- srv.numWorker = runtime.NumCPU() // TODO: make this configurable
+ srv.numWorker = runtime.NumCPU()
+ if cfg.Workers > 0 {
+ srv.numWorker = cfg.Workers
+ }
srv.quit = make(chan bool)
srv.done = &sync.WaitGroup{}
srv.ingestChan = make(chan ingestToken, srv.numWorker)
@@ -182,6 +189,6 @@ func NewServer(cfg SrvConfig) (srv *Server, err error) {
srv.ingestWorker(idx)
}(i)
}
- s5l.Printf("srv: started")
+ s5l.Printf("srv: started with %d worker", srv.numWorker)
return
}