initial work on publish

This commit is contained in:
Jimmy Zelinskie
2013-08-04 23:01:25 -04:00
parent a6d04f6790
commit dcc2621ec3
5 changed files with 61 additions and 5 deletions
+5
View File
@@ -34,6 +34,8 @@ type Server struct {
waitgroup sync.WaitGroup
pubChan chan string
http.Server
}
@@ -46,6 +48,7 @@ func New(conf *config.Config) (*Server, error) {
s := &Server{
conf: conf,
dbConnPool: pool,
pubChan: make(chan string),
Server: http.Server{
Addr: conf.Addr,
ReadTimeout: conf.ReadTimeout.Duration,
@@ -66,6 +69,7 @@ func (s *Server) ListenAndServe() error {
s.startTime = time.Now()
go s.updateRPM()
go s.publish()
s.Serve(s.listener)
s.waitgroup.Wait()
@@ -79,6 +83,7 @@ func (s *Server) Stop() error {
if err != nil {
return err
}
close(s.pubChan)
return s.listener.Close()
}