Socket
Socket
Sign inDemoInstall

aerospike

Package Overview
Dependencies
Maintainers
3
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.1 to 3.0.2

examples/test.log

6

History.md

@@ -0,1 +1,7 @@

v3.0.2 / 2017-10-09
===================
* **Bug Fixes**
* Release event loop on #close even if client not connected [#225](https://github.com/aerospike/aerospike-client-nodejs/issues/225)
v3.0.1 / 2017-10-06

@@ -2,0 +8,0 @@ ===================

16

lib/client.js

@@ -52,6 +52,2 @@ // *****************************************************************************

function Client (config) {
if (asEventLoop.eventLoopReleased()) {
throw new Error('Event loop resources have already been released! Call Client#close() with releaseEventLoop set to false to avoid this error.')
}
EventEmitter.call(this)

@@ -433,6 +429,7 @@

}
if (!this.isConnected(false)) return
this.connected = false
this.as_client.close()
_connectedClients -= 1
if (this.isConnected(false)) {
this.connected = false
this.as_client.close()
_connectedClients -= 1
}
if (releaseEventLoop && _connectedClients === 0) {

@@ -469,3 +466,6 @@ asEventLoop.releaseEventLoop()

*
* @throws {Error} if event loop resources have already been released.
*
* @see {@link Config#connTimeoutMs} - Initial host connection timeout in milliseconds.
* @see module:aerospike.releaseEventLoop
*

@@ -472,0 +472,0 @@ * @example <caption>Using callback function</caption>

@@ -27,3 +27,3 @@ // *****************************************************************************

*/
var _eventLoopReleased = false
let _eventLoopReleased = false

@@ -36,3 +36,3 @@ /**

*/
var _eventLoopInitialized = false
let _eventLoopInitialized = false

@@ -72,3 +72,3 @@ /**

function releaseEventLoop () {
_eventLoopReleased = true
if (_eventLoopReleased) return
if (as.get_cluster_count() > 0) {

@@ -78,2 +78,3 @@ setTimeout(releaseEventLoop, 5)

as.release_as_event_loop()
_eventLoopReleased = true
}

@@ -85,10 +86,7 @@ }

*/
function eventLoopReleased () {
return _eventLoopReleased
}
function registerASEventLoop () {
if (_eventLoopReleased) {
throw new Error('Event loop resources have already been released! Call Client#close() with releaseEventLoop set to false to avoid this error.')
}
/**
* @private
*/
function registerASEventLoop () {
if (!_eventLoopInitialized) {

@@ -102,4 +100,3 @@ as.register_as_event_loop()

releaseEventLoop: releaseEventLoop,
eventLoopReleased: eventLoopReleased,
registerASEventLoop: registerASEventLoop
}
{
"name": "aerospike",
"version": "3.0.1",
"version": "3.0.2",
"description": "Aerospike Client Library",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,2 +22,3 @@ // *****************************************************************************

const Aerospike = require('../lib/aerospike')
const AerospikeError = Aerospike.AerospikeError
const Client = Aerospike.Client

@@ -58,2 +59,23 @@ const helper = require('./test_helper')

describe('#close', function () {
it('should be a no-op if close is called after connection error', function (done) {
const client = new Client({hosts: '127.0.0.1:0'})
client.connect(error => {
expect(error.message).to.match(/Failed to connect/)
client.close(false)
done()
})
})
it('should be possible to call close multiple times', function (done) {
const client = new Client(helper.config)
client.connect(error => {
expect(error).to.be(null)
client.close(false)
client.close(false)
done()
})
})
})
describe('#isConnected', function () {

@@ -60,0 +82,0 @@ context('without tender health check', function () {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc