Merge branch 'fix-blob-race-condition'
This commit is contained in:
commit
408e1bff72
2 changed files with 4 additions and 7 deletions
|
@ -14,7 +14,7 @@ at anytime.
|
|||
|
||||
### Fixed
|
||||
* fixed token validation error when the dht node has just been started (https://github.com/lbryio/lbry/issues/1248)
|
||||
*
|
||||
* fixed a race condition when inserting a blob into the database (https://github.com/lbryio/lbry/issues/1129)
|
||||
|
||||
### Deprecated
|
||||
*
|
||||
|
|
|
@ -226,12 +226,9 @@ class SQLiteStorage(object):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def add_known_blob(self, blob_hash, length):
|
||||
status = yield self.get_blob_status(blob_hash)
|
||||
if status is None:
|
||||
status = "pending"
|
||||
yield self.db.runOperation("insert into blob values (?, ?, ?, ?, ?, ?, ?)",
|
||||
(blob_hash, length, 0, 0, status, 0, 0))
|
||||
defer.returnValue(status)
|
||||
yield self.db.runOperation(
|
||||
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?)", (blob_hash, length, 0, 0, "pending", 0, 0)
|
||||
)
|
||||
|
||||
def should_announce(self, blob_hash):
|
||||
return self.run_and_return_one_or_none(
|
||||
|
|
Loading…
Add table
Reference in a new issue