##// END OF EJS Templates
Source fetching: Use proper time stamps, log start and end timestamps
neko259 -
r1969:95da31b9 default
parent child Browse files
Show More
@@ -41,8 +41,9 b' class ThreadSource(models.Model):'
41 if self.thread.is_archived():
41 if self.thread.is_archived():
42 logger.error('The thread {} is archived, please try another one'.format(self.thread))
42 logger.error('The thread {} is archived, please try another one'.format(self.thread))
43 else:
43 else:
44 start_timestamp = timezone.localtime(self.timestamp)
44 start_timestamp = self.timestamp
45 last_timestamp = start_timestamp
45 last_timestamp = start_timestamp
46 logger.info('Start timestamp is {}'.format(start_timestamp))
46 if self.thread.is_bumplimit():
47 if self.thread.is_bumplimit():
47 logger.warn('The thread {} has reached its bumplimit, please create a new one'.format(self.thread))
48 logger.warn('The thread {} has reached its bumplimit, please create a new one'.format(self.thread))
48 if self.source_type == SOURCE_TYPE_RSS:
49 if self.source_type == SOURCE_TYPE_RSS:
@@ -56,11 +57,11 b' class ThreadSource(models.Model):'
56 else:
57 else:
57 if timestamp > last_timestamp:
58 if timestamp > last_timestamp:
58 last_timestamp = timestamp
59 last_timestamp = timestamp
59
60 if timestamp > start_timestamp:
60 if timestamp > start_timestamp:
61 Post.objects.create_post(title=title, text=item.description, thread=self.thread, file_urls=[item.link])
61 Post.objects.create_post(title=title, text=item.description, thread=self.thread, file_urls=[item.link])
62 logger.info('Fetched item {} from {} into thread {}'.format(
62 logger.info('Fetched item {} from {} into thread {}'.format(
63 title, self.name, self.thread))
63 title, self.name, self.thread))
64 logger.info('New timestamp is {}'.format(last_timestamp))
64 self.timestamp = last_timestamp
65 self.timestamp = last_timestamp
65 self.save(update_fields=['timestamp'])
66 self.save(update_fields=['timestamp'])
66
67
General Comments 0
You need to be logged in to leave comments. Login now