breejs / bree

Bree is a Node.js and JavaScript job task scheduler with worker threads, cron, Date, and human syntax. Built for @ladjs, @forwardemail, @spamscanner, @cabinjs.

Home Page:https://jobscheduler.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[fix] Bree not working with Later

Sja91 opened this issue · comments

commented

Node.js version: 18.17.1

OS version: Ubuntu 20.04 and Windows 10

Description: Attempting to use Later to create a complex schedule for Bree, but does not work with even a basic example.

Actual behavior

Attempting to run code results in error.

node:internal/per_context/domexception:53
    ErrorCaptureStackTrace(this);
    ^
DOMException [DataCloneError]: function() {
        values = arguments[0] instanceof Array ? arguments[0] : arguments;
        return this;
      } could not be cloned.

Expected behavior

Should see an output every 1 second.

Code to reproduce

const Bree = require('bree');
const Later = require('later');

const b = new Bree({
    root: false,
    jobs: [
        {
            name: 'job with function',
            path: () => { console.log('qwerty') },
            interval: Later.parse.recur().every(1).second()
        }
    ]
});

b.start();

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
commented

I did already look through the issues several times, but decided to look again, go figure it is always after you ask for help that you find the answer.

Found it in #85

I think this should probably be added into the documentation.