diff options
| author | 2019-10-08 13:49:43 +0100 | |
|---|---|---|
| committer | 2019-10-08 13:49:55 +0100 | |
| commit | 7a5edccb982a9aa3d1d1557d5928d03046bda29e (patch) | |
| tree | cfa252ad88198d0ff2f8fd593916818e373789b9 /modules/database_backup.py | |
| parent | refactor anything that effects event poll timeout in to PollHook objects (diff) | |
| signature | ||
transient timers shouldn't use the event system
Diffstat (limited to 'modules/database_backup.py')
| -rw-r--r-- | modules/database_backup.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/database_backup.py b/modules/database_backup.py index 55f18a13..2166be1d 100644 --- a/modules/database_backup.py +++ b/modules/database_backup.py @@ -10,11 +10,10 @@ class Module(ModuleManager.BaseModule): until_next_hour = 60-now.second until_next_hour += ((60-(now.minute+1))*60) - self.timers.add("database-backup", BACKUP_INTERVAL, + self.timers.add("database-backup", self._backup, BACKUP_INTERVAL, time.time()+until_next_hour) - @utils.hook("timer.database-backup") - def backup(self, event): + def _backup(self, timer): location = self.bot.database.location files = glob.glob("%s.*" % location) files = sorted(files) @@ -26,4 +25,4 @@ class Module(ModuleManager.BaseModule): backup_file = "%s.%s" % (location, suffix) shutil.copy2(location, backup_file) - event["timer"].redo() + timer.repo() |
