Commit Graph

5 Commits

Author SHA1 Message Date
Naz
34411cfcc1 Improved documentation and job examples
refs  #122

- As job signature has changed in 3bca4f63b8 and documentation needed updates accordingly
2021-01-07 15:17:38 +13:00
Naz
30c9112bb5 Updated example of scheduled on off job using date 2020-12-03 15:53:10 +13:00
Naz
eb0eb2d744 Added support for one off scheduled jobs
closes #115

- When scheduling one off job for future execution you can now pass in Date as a first parameter to `scheduleJob` method
2020-12-02 21:26:15 +13:00
Naz
f1ab1597e8 Changed scheduled jobs not run immediately after initialization
refs https://github.com/breejs/bree/issues/50
2020-11-23 14:24:24 +13:00
Naz
4b18cbcbdb Added support for worker threads in scheduled jobs
no issue

- When jobs are performing CPU intensive tasks they block main process'
event loop. They also can cause memory leaks or unexpected crashes
effectively crashing the parent proccess. To address these issues jobs need to be performed off of main
process. Worker Threads (https://nodejs.org/dist/latest-v12.x/docs/api/worker_threads.html)
are the best candidate for such work.
- These changes introduce an integration on top of bree
(https://github.com/breejs/bree/) which allows to run recurring
jobs in worker thereads. It falls back to child process execution for
Node v10 running without `--experimental-worker` flag.
- bree was chosen not only because it gives a polyfill for older Node
versions. It has support for some of the future use-cases Ghost is looking to
implement, like scheduled jobs.
- This changeset also includes a complete example of job running on an
interval with a possibility for graceful shutdown
2020-11-19 17:59:36 +13:00