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.
https://jobscheduler.net
MIT License
3.04k stars 79 forks source link

[fix] Bree not working with Later #224

Closed Sja91 closed 1 year ago

Sja91 commented 1 year ago

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

Sja91 commented 1 year ago

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 https://github.com/breejs/bree/issues/85

I think this should probably be added into the documentation.