@ikonintegration/ikapi 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Database/DDB/IKDB.js +6 -4
package/package.json
CHANGED
package/src/Database/DDB/IKDB.js
CHANGED
|
@@ -21,12 +21,14 @@ export default class IKDB_DDB extends IKDB {
|
|
|
21
21
|
// if (config && this.tableName) { localConsole.debug(`Using table: ${this.tableName} on region: ${this.region}`); }
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async _getConnection() {
|
|
25
|
-
if ((!DDB_CONN && !DDB_CONN_HASH) || DDB_CONN_HASH != sha1(this.region)) DDB_CONN = await this._newConnection(this.config);
|
|
26
|
-
return DDB_CONN;
|
|
27
|
-
}
|
|
28
24
|
async connect() {
|
|
29
25
|
const localConsole = (this.transaction ? this.transaction.logger : console);
|
|
26
|
+
//Reusability logic
|
|
27
|
+
if (!((!DDB_CONN && !DDB_CONN_HASH) || DDB_CONN_HASH != sha1(this.region))) {
|
|
28
|
+
localConsole.debug("Reusing database connection");
|
|
29
|
+
this.connection = DDB_CONN;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
30
32
|
//setup db
|
|
31
33
|
if (Utils.isOffline()) {
|
|
32
34
|
localConsole.debug("Starting offline database connection");
|