# HG changeset patch # User neko259 # Date 2017-11-21 14:51:55 # Node ID 95da31b9ee503d4d43d660e6c7a3fb97c58b7fcc # Parent 81b9b63613df45029624f05f23ba3ed321cb5e76 Source fetching: Use proper time stamps, log start and end timestamps diff --git a/boards/models/source.py b/boards/models/source.py --- a/boards/models/source.py +++ b/boards/models/source.py @@ -41,8 +41,9 @@ class ThreadSource(models.Model): if self.thread.is_archived(): logger.error('The thread {} is archived, please try another one'.format(self.thread)) else: - start_timestamp = timezone.localtime(self.timestamp) + start_timestamp = self.timestamp last_timestamp = start_timestamp + logger.info('Start timestamp is {}'.format(start_timestamp)) if self.thread.is_bumplimit(): logger.warn('The thread {} has reached its bumplimit, please create a new one'.format(self.thread)) if self.source_type == SOURCE_TYPE_RSS: @@ -56,11 +57,11 @@ class ThreadSource(models.Model): else: if timestamp > last_timestamp: last_timestamp = timestamp - if timestamp > start_timestamp: Post.objects.create_post(title=title, text=item.description, thread=self.thread, file_urls=[item.link]) logger.info('Fetched item {} from {} into thread {}'.format( title, self.name, self.thread)) + logger.info('New timestamp is {}'.format(last_timestamp)) self.timestamp = last_timestamp self.save(update_fields=['timestamp'])