Big Brother Bot B3 is a complete and total server administration package for online games. B3 is designed primarily to keep your server free from the derelicts of online gaming, but offers more, much more.
[FIX] Bug in Publist Plugin makes b3 instantly crash on calculating initial heartbeat time if launched when local time is in XX:55 - XX:59 interval #20
# planning initial heartbeat
# v1.9.1: Changing the threaded timer to a one time crontab to enable quick shutdown of the bot.
_im = int(time.strftime('%M')) + self._initial_heartbeat_delay_minutes
self.info('initial heartbeat will be sent to B3 master server at %s:%s hrs' % (time.strftime('%H'), _im))
self._cronTab = b3.cron.OneTimeCronTab(self.update, 0, _im, '*', '*', '*', '*')
###Explanation
_initial_heartbeat_delay_minutes is 5 by default. When your system time is in the very last 5 minutes of any hour, b3 will calculate that it should schedule sending initial heartbeat at 60th-64th minute of a hour and immediately crash if launched during that period. Running systems are not affected.
###Fix
Add this before calling b3.cron.OneTimeCronTab():
if (_im >= 60):
_im -= 60
### Trace:
110112 02:55:52 INFO STDOUT Error: accepted range is 0-59
File "E:\Servers\cod4\b3\__init__.py", line 177, in start
console.start()
File "E:\Servers\cod4\b3\parser.py", line 401, in start
self.startPlugins()
File "E:\Servers\cod4\b3\parser.py", line 668, in startPlugins
p.onStartup()
File "E:\Servers\cod4\b3\plugins\publist.py", line 144, in onStartup
self._cronTab = b3.cron.OneTimeCronTab(self.update, 0, _im, '*', '*', '*', '*')
File "E:\Servers\cod4\b3\cron.py", line 192, in __init__
CronTab.__init__(self, command, second, minute, hour, day, month, dow)
File "E:\Servers\cod4\b3\cron.py", line 58, in __init__
self.minute = minute
File "E:\Servers\cod4\b3\b3\cron.py", line 75, in _set_minute
self._minute = self._getRate(value, 60)
File "E:\Servers\cod4\b3\b3\cron.py", line 125, in _getRate
raise ValueError('accepted range is 0-%s' % (max-1))
Erroneous code:
###Explanation _initial_heartbeat_delay_minutes is 5 by default. When your system time is in the very last 5 minutes of any hour, b3 will calculate that it should schedule sending initial heartbeat at 60th-64th minute of a hour and immediately crash if launched during that period. Running systems are not affected. ###Fix Add this before calling b3.cron.OneTimeCronTab(): ### Trace: