Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _get_notifications(self):
- """
- Получение нотификаций для отправки.
- """
- ft_notifications = NotificationTask.get_by_statuses('new')
- ft_notifications = \
- ft_notifications[:settings.NOTIFICATION_NUM_FIRST_TIME]
- if settings.NOTIFICATION_TWO_DAEMONS:
- self.notification_count = ft_notifications.count()
- return ft_notifications
- else:
- re_notifications = \
- NotificationTask.get_by_statuses('retry').filter(
- next_time__lte=datetime.datetime.now()).order_by('next_time')
- re_notifications = \
- re_notifications[:settings.NOTIFICATION_NUM_RETRY_TIME]
- self.notification_count = \
- ft_notifications.count() + re_notifications.count()
- return itertools.chain(ft_notifications, re_notifications)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement