Added mixed connector type for NATIVE/REST for the crash_gen tool
This commit is contained in:
parent
2f8714e5cf
commit
9dadb8f4ea
|
@ -84,8 +84,17 @@ class WorkerThread:
|
||||||
# Let us have a DB connection of our own
|
# Let us have a DB connection of our own
|
||||||
if (gConfig.per_thread_db_connection): # type: ignore
|
if (gConfig.per_thread_db_connection): # type: ignore
|
||||||
# print("connector_type = {}".format(gConfig.connector_type))
|
# print("connector_type = {}".format(gConfig.connector_type))
|
||||||
self._dbConn = DbConn.createNative() if (
|
if gConfig.connector_type == 'native':
|
||||||
gConfig.connector_type == 'native') else DbConn.createRest()
|
self._dbConn = DbConn.createNative()
|
||||||
|
elif gConfig.connector_type == 'rest':
|
||||||
|
self._dbConn = DbConn.createRest()
|
||||||
|
elif gConfig.connector_type == 'mixed':
|
||||||
|
if Dice.throw(2) == 0: # 1/2 chance
|
||||||
|
self._dbConn = DbConn.createNative()
|
||||||
|
else:
|
||||||
|
self._dbConn = DbConn.createRest()
|
||||||
|
else:
|
||||||
|
raise RuntimeError("Unexpected connector type: {}".format(gConfig.connector_type))
|
||||||
|
|
||||||
self._dbInUse = False # if "use db" was executed already
|
self._dbInUse = False # if "use db" was executed already
|
||||||
|
|
||||||
|
@ -528,7 +537,7 @@ class LinearQueue():
|
||||||
|
|
||||||
class DbConn:
|
class DbConn:
|
||||||
TYPE_NATIVE = "native-c"
|
TYPE_NATIVE = "native-c"
|
||||||
TYPE_REST = "rest-api"
|
TYPE_REST = "rest-api"
|
||||||
TYPE_INVALID = "invalid"
|
TYPE_INVALID = "invalid"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -735,7 +744,7 @@ class MyTDSql:
|
||||||
class DbConnNative(DbConn):
|
class DbConnNative(DbConn):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._type = self.TYPE_REST
|
self._type = self.TYPE_NATIVE
|
||||||
self._conn = None
|
self._conn = None
|
||||||
self._cursor = None
|
self._cursor = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue