Try fix Recursive use of cursors ProgrammingError by creating new cursor for every execute and move Lock to db
This commit is contained in:
parent
afd23849a6
commit
fca9db7972
6 changed files with 51 additions and 27 deletions
|
@ -72,12 +72,12 @@ class ContentManagerPlugin(object):
|
|||
return super(ContentManagerPlugin, self).optionalDownloaded(inner_path, hash_id, size, own)
|
||||
|
||||
def optionalRemoved(self, inner_path, hash_id, size=None):
|
||||
self.contents.db.execute(
|
||||
res = self.contents.db.execute(
|
||||
"UPDATE file_optional SET is_downloaded = 0, is_pinned = 0, peer = peer - 1 WHERE site_id = :site_id AND inner_path = :inner_path AND is_downloaded = 1",
|
||||
{"site_id": self.contents.db.site_ids[self.site.address], "inner_path": inner_path}
|
||||
)
|
||||
|
||||
if self.contents.db.cur.cursor.rowcount > 0:
|
||||
if res.rowcount > 0:
|
||||
back = super(ContentManagerPlugin, self).optionalRemoved(inner_path, hash_id, size)
|
||||
# Re-add to hashfield if we have other file with the same hash_id
|
||||
if self.isDownloaded(hash_id=hash_id, force_check_db=True):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue