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

beanstalkd

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beanstalkd - npm Package Compare versions

Comparing version 0.1.3 to 1.0.0

36

lib/reader.js

@@ -107,2 +107,4 @@ 'use strict';

(_get2 = _get(Object.getPrototypeOf(BodyReader.prototype), 'constructor', this)).call.apply(_get2, [this, expectation].concat(types));
this['continue'] = null;
}

@@ -118,2 +120,27 @@

value: function handle(data, resolve, reject) {
if (this['continue']) {
var _continue = this['continue'];
var _length = _continue.length;
var _result = _continue.result;
var _body = _continue.body;
_body = Buffer.concat([_body, data]);
if (_body.length - _misc.CRLF.length < _length) {
this['continue'].body = _body;
return false;
}
this['continue'] = null;
_body = _body.slice(0, _length);
remainder = _body.slice(_length + _misc.CRLF.length);
_body = this.parseBody(_body);
_result.push(_body);
_result = parseResult(_result, this.types);
resolve(_result.length > 1 ? _result : _result[0]);
return remainder;
}
var _extractHeader3 = extractHeader(data);

@@ -135,6 +162,11 @@

if (remainder.length < length) {
throw new Error('Im lost!');
this['continue'] = {
result: result,
body: remainder,
length: length
};
return false;
} else {
body = remainder.slice(0, length);
remainder = remainder.slice(length + _misc.CRLF.length, remainder.length);
remainder = remainder.slice(length + _misc.CRLF.length);
}

@@ -141,0 +173,0 @@

2

package.json
{
"name": "beanstalkd",
"version": "0.1.3",
"version": "1.0.0",
"description": "A beanstalkd client for Node.js with promises",

@@ -5,0 +5,0 @@ "main": "lib/client.js",

@@ -38,1 +38,5 @@ # node-beanstalkd-client

Method names are the same as beanstalk command names camelCased, list-tubes-watched becomes listTubesWatched.
## Debugging
Use `DEBUG=beanstalkd*` to enable verbose debugging.

@@ -74,6 +74,8 @@ import Client from 'client';

}).then(() => {
return this.client.put(0, 0, 60, JSON.stringify(values)).then((putId) => {
return this.client.put(0, 0, 180, JSON.stringify(values)).then((putId) => {
return worker.reserveWithTimeout(0).spread((reserveId, body) => {
expect(putId).to.equal(reserveId);
expect(JSON.parse(body.toString())).to.deep.equal(values);
return worker.destroy(putId);
});

@@ -85,3 +87,59 @@ });

});
it('should be able to put a large job', function () {
let worker = new Client(host, port)
, tube = Math.random().toString()
, values = {};
for (let i = 0; i < 1750; i++) {
values[Math.random().toString()] = Math.random().toString();
}
return worker.connect().then(() => {
return Promise.join(
this.client.use(tube),
worker.watch(tube).then(function () {
return worker.ignore('default');
})
);
}).then(() => {
return this.client.put(0, 0, 180, JSON.stringify(values)).then((putId) => {
return worker.reserveWithTimeout(0).spread((reserveId, body) => {
expect(putId).to.equal(reserveId);
expect(JSON.parse(body.toString())).to.deep.equal(values);
});
});
}).finally(function () {
worker.quit();
});
});
it('should be able to put a extremely large job', function () {
let worker = new Client(host, port)
, tube = Math.random().toString()
, values = {};
for (let i = 0; i < 10000; i++) {
values[Math.random().toString()] = Math.random().toString();
}
return worker.connect().then(() => {
return Promise.join(
this.client.use(tube),
worker.watch(tube).then(function () {
return worker.ignore('default');
})
);
}).then(() => {
return this.client.put(0, 0, 180, JSON.stringify(values)).then((putId) => {
return worker.reserveWithTimeout(0).spread((reserveId, body) => {
expect(putId).to.equal(reserveId);
expect(JSON.parse(body.toString())).to.deep.equal(values);
});
});
}).finally(function () {
worker.quit();
});
});
});
});

Sorry, the diff of this file is not supported yet

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