mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Schedule database pragma optimize
This commit is contained in:
parent
02658759ea
commit
60bdf1d1ce
2 changed files with 12 additions and 1 deletions
|
@ -439,7 +439,7 @@ def initialize_scheduler():
|
|||
|
||||
backup_hours = CONFIG.BACKUP_INTERVAL if 1 <= CONFIG.BACKUP_INTERVAL <= 24 else 6
|
||||
|
||||
schedule_job(database.optimize, 'Optimize Tautulli database',
|
||||
schedule_job(database.optimize_db, 'Optimize Tautulli database',
|
||||
hours=24, minutes=0, seconds=0)
|
||||
schedule_job(database.make_backup, 'Backup Tautulli database',
|
||||
hours=backup_hours, minutes=0, seconds=0, args=(True, True))
|
||||
|
|
|
@ -286,7 +286,18 @@ def vacuum():
|
|||
|
||||
|
||||
def optimize():
|
||||
monitor_db = MonitorDatabase()
|
||||
|
||||
logger.info("Tautulli Database :: Optimizing database.")
|
||||
try:
|
||||
monitor_db.action('PRAGMA optimize')
|
||||
except Exception as e:
|
||||
logger.error("Tautulli Database :: Failed to optimize database: %s" % e)
|
||||
|
||||
|
||||
def optimize_db():
|
||||
vacuum()
|
||||
optimize()
|
||||
|
||||
|
||||
def db_filename(filename=FILENAME):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue