Skip to content

Commit 3290246

Browse files
committed
restore torrent rowid on restart
1 parent 7207707 commit 3290246

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lbry/extras/daemon/storage.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ def get_all_lbry_files(self) -> typing.Awaitable[typing.List[typing.Dict]]:
638638

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

lbry/torrent/torrent_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async def initialize_from_database(self):
183183
claim = await self.storage.get_content_claim_for_torrent(file['bt_infohash'])
184184
file['download_directory'] = bytes.fromhex(file['download_directory'] or '').decode() or None
185185
file['file_name'] = bytes.fromhex(file['file_name'] or '').decode() or None
186-
await self._load_stream(None, claim=claim, **file)
186+
await self._load_stream(claim=claim, **file)
187187

188188
async def start(self):
189189
await super().start()

0 commit comments

Comments
 (0)