From 9189f9243229feda79a9eb3569bd32a20734efcd Mon Sep 17 00:00:00 2001 From: Thorsten Date: Fri, 7 Nov 2014 17:31:21 +0100 Subject: [PATCH] Logging expire & Bugfix **** Not done yet **** + Bugfix: The data of the startup ICCC message was not proper set + Changed the logging expire --- Log/DeviceDatabase/InitDB.go | 10 ++++------ WebServer/Start.go | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Log/DeviceDatabase/InitDB.go b/Log/DeviceDatabase/InitDB.go index 220b2bc..5177d58 100644 --- a/Log/DeviceDatabase/InitDB.go +++ b/Log/DeviceDatabase/InitDB.go @@ -58,14 +58,12 @@ func initDatabase() { // indexTimeUTC := mgo.Index{} indexTimeUTC.Key = []string{`TimeUTC`} - logDBCollection.EnsureIndex(indexTimeUTC) - if expire { - indexTTL := mgo.Index{} - indexTTL.Key = []string{`TimeUTC`} - indexTTL.ExpireAfter = time.Duration(expireAfterDays) * time.Hour * 24 - logDBCollection.EnsureIndex(indexTTL) + indexTimeUTC.ExpireAfter = time.Duration(expireAfterDays*24) * time.Hour + } else { + indexTimeUTC.ExpireAfter = time.Duration(0) } + logDBCollection.EnsureIndex(indexTimeUTC) indexProject := mgo.Index{} indexProject.Key = []string{`Project`} diff --git a/WebServer/Start.go b/WebServer/Start.go index 3fe75d0..8559c61 100644 --- a/WebServer/Start.go +++ b/WebServer/Start.go @@ -11,7 +11,6 @@ func Start() { // Tell the whole cluster, that we are up and ready: data := SystemMessages.ICCCStartUpMessage{} - defer ICCC.WriteMessage2All(ICCC.ChannelSYSTEM, `System::Start`, data) if serverPublic != nil { data.PublicIPAddressAndPort = serverPublicAddressPort @@ -24,4 +23,6 @@ func Start() { Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Admin web server is now listening.`, `Configuration for hostname and port.`, serverAdminAddressPort) go serverAdmin.ListenAndServe() } + + ICCC.WriteMessage2All(ICCC.ChannelSYSTEM, `System::Start`, data) }