diff --git a/main.go b/main.go index 90dff75..89abb86 100644 --- a/main.go +++ b/main.go @@ -81,6 +81,11 @@ func main() { go CloseSatelOnCtrlC(s, &cleanShutdown) + closeDebugTools := make(chan interface{}) + if config.WriteMemoryProfile { + WriteMemoryProfilePeriodically(&wg, log.New(os.Stderr, "DebugTools", log.Lmicroseconds), closeDebugTools) + } + for e := range FilterByTypeOrIndex( FilterByLastSeen(s.Events, &wg, &dataStore, log.New(os.Stderr, "FilterByLastSeen", log.Lmicroseconds)), &wg, config.AllowedTypes, config.AllowedIndexes) { @@ -88,8 +93,6 @@ func main() { tgEvents <- GenericMessage{e.BasicEvents} } - closeDebugTools := make(chan interface{}) - WriteMemoryProfilePeriodically(&wg, log.New(os.Stderr, "DebugTools", log.Lmicroseconds), closeDebugTools) logger.Print("Closing...") close(closeDebugTools) close(tgEvents)