forked from LBRYCommunity/lbry-sdk
restore torrent rowid on restart
This commit is contained in:
parent
9dc617f8e0
commit
5cf63fa03e
2 changed files with 3 additions and 2 deletions
|
@ -638,7 +638,8 @@ class SQLiteStorage(SQLiteMixin):
|
|||
|
||||
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))
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ class TorrentManager(SourceManager):
|
|||
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()
|
||||
|
|
Loading…
Reference in a new issue