From 6b138b98a6a92d31263dfcf8075e432f0df40649 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 13 Sep 2013 18:29:34 +0200 Subject: use before and after update hooks to delete items only after new ones have been fetched --- bin/updater.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/updater.py b/bin/updater.py index e951c27c7..149ef5b3d 100644 --- a/bin/updater.py +++ b/bin/updater.py @@ -94,7 +94,8 @@ class Updater: self.base_url += '/' self.base_url += 'index.php/apps/news/api/v1-2' - self.cleanup_url = '%s/cleanup' % self.base_url + self.before_cleanup_url = '%s/cleanup/before-update' % self.base_url + self.after_cleanup_url = '%s/cleanup/after-update' % self.base_url self.all_feeds_url = '%s/feeds/all' % self.base_url self.update_url = '%s/feeds/update' % self.base_url @@ -105,7 +106,7 @@ class Updater: opener = get_basic_auth_opener(self.base_url, self.user, self.password) # run the cleanup request and get all the feeds to update - opener.open(self.cleanup_url) + opener.open(self.before_cleanup_url) feeds_response = opener.open(self.all_feeds_url) feeds_json = feeds_response.read().decode('utf-8') feeds = json.loads(feeds_json)['feeds'] @@ -121,6 +122,8 @@ class Updater: for thread in threads: thread.join() + opener.open(self.after_cleanup_url) + if self.run_once: return -- cgit v1.2.3