From: Magnus Hagander Date: Wed, 10 Feb 2016 21:09:53 +0000 (+0100) Subject: Save feed status directly instead of at end of processing X-Git-Url: http://git.postgresql.org/gitweb/static/%7B%7Bpguslink%28?a=commitdiff_plain;h=baefbd4de052774e75c52e7830ba396b4c8b3664;p=hamn.git Save feed status directly instead of at end of processing Since processing can take a long time with slow blogs, store the date before that happens. This will prevent from conflicting with the web UI and overwriting the settings from that one. --- diff --git a/hamnadmin/hamnadmin/register/management/commands/aggregate_feeds.py b/hamnadmin/hamnadmin/register/management/commands/aggregate_feeds.py index cea8d27..007bf63 100644 --- a/hamnadmin/hamnadmin/register/management/commands/aggregate_feeds.py +++ b/hamnadmin/hamnadmin/register/management/commands/aggregate_feeds.py @@ -86,8 +86,6 @@ class Command(BaseCommand): entries += 1 titles.append(entry.title) total_entries += 1 - # Save an update to when the feed was last scanned - feed.save() if entries > 0 and feed.approved: # Email a notification that they were picked up diff --git a/hamnadmin/hamnadmin/util/aggregate.py b/hamnadmin/hamnadmin/util/aggregate.py index a6610db..5e21f91 100644 --- a/hamnadmin/hamnadmin/util/aggregate.py +++ b/hamnadmin/hamnadmin/util/aggregate.py @@ -105,11 +105,13 @@ class FeedFetcher(object): d = datetime.datetime.now() self.feed.lastget = d + self.feed.save() else: # We didn't get a Last-Modified time, so set it to the entry date # for the latest entry in this feed. if self.newest_entry_date: self.feed.lastget = self.newest_entry_date + self.feed.save() def matches_filter(self, entry): # For now, we only match against self.feed.authorfilter. In the future,