Skip to content

Commit

Permalink
Fixes #6115: Move an async function call out of the db_session scope
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlovsky committed May 28, 2021
1 parent a7cf175 commit 1804dc7
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ async def regenerate_channel_torrent(self, channel_pk, channel_id):
if channel is None:
self._logger.warning("Tried to regenerate non-existing channel %s %i", hexlify(channel_pk), channel_id)
return None
for d in self.session.dlmgr.get_downloads_by_name(channel.dirname):
await self.session.dlmgr.remove_download(d, remove_content=True)
channel_dirname = channel.dirname
for d in self.session.dlmgr.get_downloads_by_name(channel_dirname):
await self.session.dlmgr.remove_download(d, remove_content=True)
with db_session:
channel = self.session.mds.ChannelMetadata.get_for_update(public_key=channel_pk, id_=channel_id)
regenerated = channel.consolidate_channel_torrent()
# If the user created their channel, but added no torrents to it,
# the channel torrent will not be created.
Expand Down

0 comments on commit 1804dc7

Please sign in to comment.