Skip to content

Commit

Permalink
Fix delete query
Browse files Browse the repository at this point in the history
  • Loading branch information
aigoncharov committed Jul 18, 2024
1 parent 19d255e commit dec0b73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "telegram-to-rss"
version = "0.2.6"
version = "0.2.7"
description = ""
authors = ["aigoncharov"]
license = "MIT"
Expand Down
6 changes: 5 additions & 1 deletion telegram_to_rss/poll_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ async def update_feed(self, dialog: custom.Dialog):
await feed.save()

old_feed_entries = (
await FeedEntry.all().offset(self._message_limit).order_by("-date")
await FeedEntry.filter(feed=feed)
.order_by("-date")
.limit(self._message_limit)
.offset(self._message_limit)
)

await FeedEntry.filter(
Q(id__in=[entry.id for entry in old_feed_entries])
).delete()
Expand Down

0 comments on commit dec0b73

Please sign in to comment.