[#164] Workers should restart periodically
They restart once a day, if the worker completes a job at least every hour. The worker ID is compared to the hour of day and if the modulus matches, then it exits (and is restarted by MCE). Should do the trick with memory usage.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
* [#161] Updated IOS-XR SSHCollector
|
||||
* [#165] Mention system clock in docs
|
||||
* [#164] Workers should restart periodically
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
|
||||
@@ -38,6 +38,13 @@ sub worker_body {
|
||||
};
|
||||
|
||||
$self->close_job($job);
|
||||
|
||||
# restart worker once a day.
|
||||
# relies on the worker seeing a job at least every hour.
|
||||
my $hour = [localtime()]->[2];
|
||||
if ($wid and (($wid % 24) == $hour)) {
|
||||
$self->exit(0, "recycling worker $wid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user