Developing lightweight computation at the DSG edge

Commit 6916e8f6 authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[monitor-assign] Allow configuring monitorTimeout



A monitor may deregister from the system another monitor that has not
updated its timestamp after monitorTimeout seconds. This commit
allows configuring monitorTimeout to any value in seconds, as long as
it is bigger than globalAssignCheckInterval and reassignInterval.
Signed-off-by: Roger Pueyo Centelles's avatarRoger Pueyo Centelles <rpueyo@ac.upc.edu>
parent 53daeba9
......@@ -54,6 +54,7 @@ var DEFAULTFILEMODE os.FileMode = 0755
// monitorTimeout defines how long to wait before removing a crashed monitor from the database
var monitorTimeout int64 = 450
var monitorTimeoutHelp = "Time before deregistering crashed monitors or in network partition"
// idNum holds the monitor id, in numberic form
var idNum int
......@@ -157,6 +158,7 @@ func initializeFlags() {
fillingTimePtr := flag.Int("fillingTime", fillingTime, fillingTimeHelp)
reassignIntervalPtr := flag.Int("reassignInterval", reassignInterval, reassignIntervalHelp)
globalAssignCheckIntervalPtr := flag.Int("globalAssignCheckInterval", globalAssignCheckInterval, globalAssignCheckIntervalHelp)
monitorTimeoutPtr := flag.Int("monitorTimeout", int(monitorTimeout), monitorTimeoutHelp)
flag.Parse()
......@@ -199,6 +201,12 @@ func initializeFlags() {
if *globalAssignCheckIntervalPtr > 0 {
globalAssignCheckInterval = *globalAssignCheckIntervalPtr
}
if *monitorTimeoutPtr > 0 {
monitorTimeout = int64(*monitorTimeoutPtr)
}
if monitorTimeout <= int64(globalAssignCheckInterval) || monitorTimeout <= int64(reassignInterval) {
monitorTimeout = int64(math.Max(float64(globalAssignCheckInterval), float64(reassignInterval))) + 1
}
}
// Get the global devices list from AntidoteDB
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment