Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aerospike

Package Overview
Dependencies
Maintainers
3
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aerospike - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

lib/event_loop.js

13

History.md

@@ -0,1 +1,8 @@

v2.0.3 / 2016-05-03
===================
* **Fixes**
* Event loop does not get released if module gets required but never used to open & close client connection.
[#124](https://github.com/aerospike/aerospike-client-nodejs/issues/124)
v2.0.2 / 2016-04-29

@@ -5,5 +12,7 @@ ===================

* **Improvements**
* Add support for node v6 by bumping nan dependency. [PR #122](https://github.com/aerospike/aerospike-client-nodejs/pull/122)
* Add support for node v6 by bumping nan dependency. [#121](https://github.com/aerospike/aerospike-client-nodejs/issues/121),
[PR #122](https://github.com/aerospike/aerospike-client-nodejs/pull/122).
Thanks to [@djMax](https://github.com/djMax)!
* Add support for Ubuntu 16.04. [PR #123](https://github.com/aerospike/aerospike-client-nodejs/pull/123)
* Add support for Ubuntu 16.04. [#118](https://github.com/aerospike/aerospike-client-nodejs/issues/118),
[PR #123](https://github.com/aerospike/aerospike-client-nodejs/pull/123).
Thanks to [@NawarA](https://github.com/NawarA)!

@@ -10,0 +19,0 @@

62

lib/aerospike.js

@@ -117,12 +117,5 @@ // *****************************************************************************

const operator = require('./operator')
const asEventLoop = require('./event_loop')
/**
* Whether event loop resources have been released
*
* @type {boolean}
* @private
*/
var _eventLoopReleased = false
/**
* @function module:aerospike.client

@@ -136,3 +129,3 @@ *

config = config || {}
return new Client(this, config)
return new Client(config)
}

@@ -177,47 +170,2 @@

/**
* @function module:aerospike.releaseEventLoop
*
* @summary Release event loop resources.
*
* @description This method releases the event loop resources held by the
* Aerospike C client library. It is normally called automatically when the
* Aerospike Node.js client instance is closed. However, when the application
* needs to create multiple client instances, then the event loop resources
* need to be released explicitly by calling this method and `releaseEventLoop
* = false` needs to be passed in the {@link Client#close} method.
*
* @example <caption>Working with multiple client instances.</caption>
*
* const Aerospike = require('aerospike')
*
* // called one or more times to handle a new work request
* function handleRequest (request) {
* Aerospike.connect(function (err, client) {
* if (err) {
* // handle error
* }
* // handle request
* client.close(false) // do not release event loop
* })
* }
*
* // called when application shuts down
* function shutdown () {
* Aerospike.releaseEventLoop()
* }
*/
function releaseEventLoop () {
_eventLoopReleased = true
if (as.get_cluster_count() > 0) {
setTimeout(releaseEventLoop, 5)
} else {
as.release_as_event_loop()
}
}
function eventLoopReleased () {
return _eventLoopReleased
}
function Aerospike () {

@@ -234,6 +182,6 @@ // classes && data types

this.connect = connect
this.eventLoopReleased = eventLoopReleased
this.key = key
this.releaseEventLoop = releaseEventLoop
this.releaseEventLoop = asEventLoop.releaseEventLoop
// other commands contained in sub-modules

@@ -796,3 +744,1 @@ this.filter = filter

module.exports = new Aerospike()
as.register_as_event_loop()

@@ -26,2 +26,4 @@ // *****************************************************************************

const asEventLoop = require('./event_loop')
// number of client instances currently connected to any Aerospike cluster

@@ -38,4 +40,4 @@ var _connectedClients = 0

*/
function Client (aerospike, config) {
if (aerospike.eventLoopReleased()) {
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.')

@@ -49,5 +51,2 @@ }

/** @private */
this.aerospike = aerospike
/**

@@ -378,3 +377,3 @@ * @name Client#config

if (releaseEventLoop && _connectedClients === 0) {
this.aerospike.releaseEventLoop()
asEventLoop.releaseEventLoop()
}

@@ -413,2 +412,3 @@ }

var self = this
asEventLoop.registerASEventLoop()
this.as_client.connect(function connectCb (err) {

@@ -415,0 +415,0 @@ self.connected = (!err || err.code === as.status.AEROSPIKE_OK)

{
"name": "aerospike",
"version": "2.0.2",
"version": "2.0.3",
"description": "Aerospike Client Library",

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

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

beforeEach(function () {
client = new Client(Aerospike, helper.config)
client = new Client(helper.config)
})

@@ -30,0 +30,0 @@ afterEach(function () {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc