Do not commit price objects to database from within thread (#1154)
* Remove database commit in price worker, essentially bringing it back to the previous functionality (pass thread list of price objects, it modifies, calls back for main thread to commit). There's probably a better way to handle this for the future creating a scoped session or something, but for now this works * E303 too many blank lines (2)
This commit is contained in:
@@ -127,9 +127,6 @@ class Price(object):
|
||||
priceobj.time = time.time() + VALIDITY
|
||||
priceobj.failed = None
|
||||
|
||||
# Update the DB.
|
||||
db.commit()
|
||||
|
||||
# delete price from working dict
|
||||
del priceMap[typeID]
|
||||
|
||||
@@ -142,9 +139,6 @@ class Price(object):
|
||||
priceobj.time = time.time() + TIMEOUT
|
||||
priceobj.failed = True
|
||||
|
||||
# Update the DB.
|
||||
db.commit()
|
||||
|
||||
del priceMap[typeID]
|
||||
except:
|
||||
# all other errors will pass and continue onward to the REREQUEST delay
|
||||
@@ -157,9 +151,6 @@ class Price(object):
|
||||
priceobj.time = time.time() + REREQUEST
|
||||
priceobj.failed = True
|
||||
|
||||
# Update the DB.
|
||||
db.commit()
|
||||
|
||||
@classmethod
|
||||
def fitItemsList(cls, fit):
|
||||
# Compose a list of all the data we need & request it
|
||||
@@ -207,6 +198,7 @@ class Price(object):
|
||||
except Exception as e:
|
||||
pyfalog.critical("Callback failed.")
|
||||
pyfalog.critical(e)
|
||||
|
||||
db.commit()
|
||||
|
||||
if waitforthread:
|
||||
|
||||
Reference in New Issue
Block a user