diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-13 18:29:34 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-13 18:29:34 +0200 |
commit | 6b138b98a6a92d31263dfcf8075e432f0df40649 (patch) | |
tree | 8f647ec1491de674f3093f24fad21521d25eec01 /bin/updater.py | |
parent | e178dc843a677fe2512ebd2247e20016eb18cd5b (diff) |
use before and after update hooks to delete items only after new ones have been fetched
Diffstat (limited to 'bin/updater.py')
-rw-r--r-- | bin/updater.py | 7 |
1 files changed, 5 insertions, 2 deletions
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 |