Skip to content

Commit

Permalink
don't fail on saving an existing pull from FetchNewPulls
Browse files Browse the repository at this point in the history
  • Loading branch information
TicClick committed Mar 21, 2021
1 parent 7b86eb6 commit e9d9ac2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion librarian/discord/cogs/background/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
commands,
tasks,
)
from sqlalchemy import exc as sql_exc

from librarian import storage
from librarian.discord import formatters
Expand Down Expand Up @@ -57,7 +58,10 @@ async def loop(self):
pull_data = await self.github.get_single_pull(self.last_pull)
if pull_data is not None:
logger.info("%s: fetched pull #%s", self.name, self.last_pull)
self.storage.pulls.save_from_payload(pull_data, insert=True)
try:
self.storage.pulls.save_from_payload(pull_data, insert=True)
except sql_exc.IntegrityError: # fetched by MonitorPulls
pass
self.last_pull += 1

elif await self.github.get_single_issue(self.last_pull) is not None:
Expand Down

0 comments on commit e9d9ac2

Please # to comment.