Misc.
+ Removed the fixed shutdown time + Added the configuration for the public web server + Refactored the old web server settings + Improved the handling of shutdown handlers. It is not save! + Bugfix: The server start was no longer blocking
This commit is contained in:
1 parent
96bcb5da8f
commit
3348e552cc
10 files changed
+63
-20
No files matched your search
+2
-7
@@ -2,7 +2,6 @@ package Log
|
||||
|
||||
import (
|
||||
"github.com/SommerEngineering/Ocean/Log/Device"
|
||||
"time"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -14,8 +13,7 @@ func Flush() {
|
||||
close(entriesBuffer)
|
||||
mutexChannel.Unlock()
|
||||
|
||||
// This is a bad design, but the scheduler need some time to write the last messages.
|
||||
time.Sleep(15 * time.Second)
|
||||
<-schedulerExitSignal
|
||||
|
||||
mutexDeviceDelays.Lock()
|
||||
dataArray := logEntryListToArray(deviceDelayBuffer)
|
||||
@@ -26,10 +24,7 @@ func Flush() {
|
||||
for entry := devices.Front(); entry != nil; entry = entry.Next() {
|
||||
dev := entry.Value.(Device.Device)
|
||||
dev.Log(dataArray) // Want to wait to complete, therefore no new thread here
|
||||
go dev.Flush()
|
||||
dev.Flush()
|
||||
}
|
||||
mutexDevices.RUnlock()
|
||||
|
||||
// This is a bad design, but the devices need (may) some time to write the last messages:
|
||||
time.Sleep(15 * time.Second)
|
||||
}
|
||||
@@ -41,6 +41,7 @@ func init() {
|
||||
preChannelBuffer = list.New()
|
||||
deviceDelayBuffer = list.New()
|
||||
devices = list.New()
|
||||
schedulerExitSignal = make(chan bool)
|
||||
|
||||
initTimer()
|
||||
initCode()
|
||||
|
||||
@@ -37,4 +37,5 @@ func scheduler(logBuffer chan Meta.Entry) {
|
||||
}
|
||||
|
||||
LogFull(senderName, Meta.CategorySYSTEM, Meta.LevelWARN, Meta.SeverityCritical, Meta.ImpactNone, Meta.MessageNameSHUTDOWN, `The scheduler is down now.`)
|
||||
schedulerExitSignal <- true
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
var (
|
||||
entriesBuffer chan Meta.Entry = nil
|
||||
schedulerExitSignal chan bool = nil
|
||||
logBufferSize int = 500
|
||||
logBufferTimeoutSeconds int = 4
|
||||
logDeviceDelayNumberEvents int = 600
|
||||
|
||||
Reference in new issue
Block a user