From be7bf92f5c2dac0a823e6be7fc529c50eb830e01 Mon Sep 17 00:00:00 2001 From: Brett Spaulding Date: Thu, 15 Jun 2023 01:38:19 -0500 Subject: [PATCH] [FIX] add purge to ensure that database is clear when dls complete --- app.py | 5 +++-- database.py | 3 +++ database/album.json | 9 +-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index 41bf64b..29e5493 100644 --- a/app.py +++ b/app.py @@ -24,8 +24,9 @@ def process_downloads(): print(album) Album.write(album['id'], {'downloading': True}) download_album(album) - else: - return + else: + # Sometimes the records are not being removed + Album.purge() cron = BackgroundScheduler({'apscheduler.job_defaults.max_instances': 3}, daemon=True) diff --git a/database.py b/database.py index 5797968..7f32058 100644 --- a/database.py +++ b/database.py @@ -83,3 +83,6 @@ class Model: def unlink(self, record_id): self.env.delete_by_id(record_id) return True + + def purge(self): + self.env.purge() diff --git a/database/album.json b/database/album.json index 65fae68..738f013 100644 --- a/database/album.json +++ b/database/album.json @@ -1,12 +1,5 @@ { "version": 2, - "keys": [ - "album", - "artist", - "cover", - "downloaded", - "downloading", - "link" - ], + "keys": [], "data": {} } \ No newline at end of file