Skip to content

Commit

Permalink
restore torrent rowid on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
shyba committed Nov 1, 2022
1 parent 7207707 commit 3290246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lbry/extras/daemon/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ def get_all_lbry_files(self) -> typing.Awaitable[typing.List[typing.Dict]]:

async def get_all_torrent_files(self) -> typing.List[typing.Dict]:
def _get_all_torrent_files(transaction):
cursor = transaction.execute("select * from file join torrent on file.bt_infohash=torrent.bt_infohash")
cursor = transaction.execute(
"select file.ROWID as rowid, * from file join torrent on file.bt_infohash=torrent.bt_infohash")
return map(lambda row: dict(zip(list(map(itemgetter(0), cursor.description)), row)), cursor.fetchall())
return list(await self.db.run(_get_all_torrent_files))

Expand Down
2 changes: 1 addition & 1 deletion lbry/torrent/torrent_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async def initialize_from_database(self):
claim = await self.storage.get_content_claim_for_torrent(file['bt_infohash'])
file['download_directory'] = bytes.fromhex(file['download_directory'] or '').decode() or None
file['file_name'] = bytes.fromhex(file['file_name'] or '').decode() or None
await self._load_stream(None, claim=claim, **file)
await self._load_stream(claim=claim, **file)

async def start(self):
await super().start()
Expand Down

0 comments on commit 3290246

Please sign in to comment.