Flush prices rather than commit, it takes much less time and still satisfies our needs

This commit is contained in:
DarkPhoenix
2019-02-13 15:56:15 +03:00
parent 6ebc90b8aa
commit 3ed949395e
2 changed files with 12 additions and 2 deletions

View File

@@ -542,7 +542,17 @@ def commit():
with sd_lock:
try:
saveddata_session.commit()
except Exception as ex:
except Exception:
saveddata_session.rollback()
exc_info = sys.exc_info()
raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])
def flush():
with sd_lock:
try:
saveddata_session.flush()
except Exception:
saveddata_session.rollback()
exc_info = sys.exc_info()
raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])

View File

@@ -458,7 +458,7 @@ class Item(EqBase):
pyfalog.debug("Creating a price for {}".format(self.ID))
self.__priceObj = types_Price(self.ID)
eos.db.add(self.__priceObj)
eos.db.commit()
eos.db.flush()
else:
self.__priceObj = db_price