Skip to content

Commit

Permalink
Add channel.last_parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnySc2 committed Jul 13, 2023
1 parent 5c8ed2c commit b76f78c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ async def parse_channel_messages() -> None:
channels_that_may_have_new_messages = set(
orm.select(
c.channel_id for c in TelegramChannel
if c.last_parsed < datetime.datetime.now() - datetime.timedelta(days=1)
if c.last_parsed < datetime.datetime.now() - datetime.timedelta(days=7)
)
)
for channel_id in SECRETS.channel_ids:
Expand Down Expand Up @@ -378,6 +378,7 @@ async def parse_channel_messages() -> None:
with orm.db_session():
channel: TelegramChannel = TelegramChannel.get(channel_id=channel_id) # pyre-fixme[35]
channel.done_parsing = True
channel.last_parsed = datetime.datetime.utcnow()
break
previous_oldest_message_id = oldest_message_id

Expand Down

0 comments on commit b76f78c

Please sign in to comment.