gremlin-aws-sigv4
Advanced tools
Comparing version 3.5.1 to 3.5.2
@@ -132,2 +132,9 @@ const debug = require('debug')('gremlin-aws-sigv4:driver'); | ||
this._rejections[queryId] = reject; | ||
if (this._client == null) { | ||
if (this.options.autoReconnect) { | ||
this._connectSocket(); | ||
} else { | ||
reject(new Error('Disconnected from database')); | ||
} | ||
} | ||
this._client.submit(bytecode) | ||
@@ -134,0 +141,0 @@ .then((result) => { |
{ | ||
"name": "gremlin-aws-sigv4", | ||
"version": "3.5.1", | ||
"version": "3.5.2", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -21,3 +21,3 @@ /* eslint-disable-line no-new */ | ||
describe('AwsSigV4DriverRemoteConnection', () => { | ||
afterEach(() => { | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
@@ -32,2 +32,5 @@ gremlin.driver.Client.mockImplementation((url) => ({ | ||
}, | ||
open: jest.fn(), | ||
submit: jest.fn(() => Promise.resolve({ toArray: jest.fn() })), | ||
close: jest.fn(), | ||
})); | ||
@@ -221,2 +224,20 @@ }); | ||
}); | ||
it('should reopen the connection and submit the query if autoReconnect is true', () => { | ||
const connection = new AwsSigV4DriverRemoteConnection( | ||
HOST, PORT, { ...OPTS, autoReconnect: true }, | ||
); | ||
connection._client = null; | ||
connection.submit(null); | ||
}); | ||
it('should fail if autoReconnect is false', () => { | ||
const connection = new AwsSigV4DriverRemoteConnection( | ||
HOST, PORT, { ...OPTS, autoReconnect: false }, | ||
); | ||
connection._client = null; | ||
connection.submit(null).catch((error) => { | ||
expect(error.toString()).toContain('Disconnected from database'); | ||
}); | ||
}); | ||
}); | ||
@@ -223,0 +244,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29302
600