From b39ec4f9b316bb860c341a39ee33f43cae28ce78 Mon Sep 17 00:00:00 2001 From: Ryan Holmes Date: Thu, 11 May 2017 01:15:07 -0400 Subject: [PATCH] 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) --- service/price.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/service/price.py b/service/price.py index fdfe8ac2c..9c6da235a 100644 --- a/service/price.py +++ b/service/price.py @@ -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: