Skip to content

Commit

Permalink
Fixed crash with ServerUpdater
Browse files Browse the repository at this point in the history
  • Loading branch information
NullSoldier committed May 20, 2018
1 parent bd2ef8e commit 6203098
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions serverthrall/plugins/serverrestarter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def ready(self, steamcmd, server, thrall):
self.restart_times = self.get_restart_times(self.config.get('restart_times'))
self.restart_dates = []

self.ensure_dates_added(self.restartmanager.warning_minutes)
self.ensure_dates_added()

if self.config.getboolean('force_restart_on_launch'):
self.config.set('force_restart_on_launch', False)
Expand All @@ -38,13 +38,16 @@ def ready(self, steamcmd, server, thrall):

self.tick_early()

def ensure_dates_added(self, warning_minutes):
def ensure_dates_added(self):
now = datetime.now()

while len(self.restart_dates) < len(self.restart_times) * 2:
self.last_restart_day = self.last_restart_day + timedelta(days=1)

restart_dates = self.get_restart_dates(self.last_restart_day, self.restart_times, warning_minutes)
restart_dates = self.get_restart_dates(
self.last_restart_day,
self.restart_times,
self.restartmanager.warning_minutes)

for restart_date in restart_dates:
if restart_date > now:
Expand Down

0 comments on commit 6203098

Please sign in to comment.