diff --git a/app/persist.go b/app/persist.go index 4f5ed69..d273ad1 100644 --- a/app/persist.go +++ b/app/persist.go @@ -37,6 +37,7 @@ func createDB(path string) *WriteDB { func DatabaseManager(c *Conf) { logDB, flushDB := c.RotateDB(true) + close(startupMatchesC) c.manageLogs(logDB, flushDB) } @@ -63,7 +64,6 @@ func (c *Conf) manageLogs(logDB *WriteDB, flushDB *WriteDB) { } func (c *Conf) RotateDB(startup bool) (*WriteDB, *WriteDB) { - defer close(startupMatchesC) var ( doesntExist bool err error @@ -192,7 +192,6 @@ func rotateDB(c *Conf, logDec *gob.Decoder, flushDec *gob.Decoder, logEnc *gob.E // store matches if !entry.Exec && entry.T.Add(filter.retryDuration).Unix() > now.Unix() { if startup { - log.Println("DEBUG db send match") startupMatchesC <- PFT{entry.Pattern, filter, entry.T} } @@ -202,7 +201,6 @@ func rotateDB(c *Conf, logDec *gob.Decoder, flushDec *gob.Decoder, logEnc *gob.E // replay executions if entry.Exec && entry.T.Add(*filter.longuestActionDuration).Unix() > now.Unix() { if startup { - log.Println("DEBUG db send match") cleanMatchesC <- PF{entry.Pattern, filter} filter.sendActions(entry.Pattern, entry.T) }