Socket
Socket
Sign inDemoInstall

bree

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bree - npm Package Compare versions

Comparing version 1.1.16 to 1.1.17

6

index.js

@@ -0,1 +1,2 @@

const EventEmitter = require('events');
const { Worker } = require('worker_threads');

@@ -14,5 +15,6 @@ const { resolve, join } = require('path');

class Bree {
class Bree extends EventEmitter {
// eslint-disable-next-line complexity
constructor(config) {
super();
this.config = {

@@ -456,2 +458,3 @@ // we recommend using Cabin for logging

});
this.emit('worker created', name);
debug('worker started', name);

@@ -517,2 +520,3 @@

delete this.workers[name];
this.emit('worker deleted', name);
});

@@ -519,0 +523,0 @@ return;

2

package.json
{
"name": "bree",
"description": "The best job scheduler for Node.js with support for cron, dates, ms, later, and human-friendly strings. Uses workers to spawn sandboxed processes, and supports async/await, retries, throttling, concurrency, and cancelable promises (graceful shutdown). Simple, fast, and the most lightweight tool for the job. Made for Forward Email and Lad.",
"version": "1.1.16",
"version": "1.1.17",
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",

@@ -6,0 +6,0 @@ "ava": {

@@ -34,2 +34,3 @@ <h1 align="center">

* [Job Interval and Timeout Values](#job-interval-and-timeout-values)
* [Listening for events](#listening-for-events)
* [Cancellation, Retries, Stalled Jobs, and Graceful Reloading](#cancellation-retries-stalled-jobs-and-graceful-reloading)

@@ -482,2 +483,24 @@ * [Interval, Timeout, Date, and Cron Validation](#interval-timeout-date-and-cron-validation)

## Listening for events
Bree extends from [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) and emits two events:
* `worker created` with an argument of `name`
* `worker deleted` with an argument of `name`
If you'd like to know when your workers are created (or deleted), you can do so through this example:
```js
bree.on('worker created', (name) => {
console.log('worker created', name);
console.log(bree.workers[name]);
});
bree.on('worker deleted', (name) => {
console.log('worker deleted', name);
console.log(typeof bree.workers[name] === 'undefined');
});
```
## Cancellation, Retries, Stalled Jobs, and Graceful Reloading

@@ -484,0 +507,0 @@

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