{"_id":"@simpleview/async-cron","_rev":"32-0b5a72a212019ec91af30019375aa08d","name":"@simpleview/async-cron","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.2":{"name":"@simpleview/async-cron","version":"0.0.2","author":{"name":"Owen Allen","email":"owenallenaz@gmail.com"},"license":"MIT","_id":"@simpleview/async-cron@0.0.2","maintainers":[{"name":"owenallenaz","email":"owenallenaz@gmail.com"},{"name":"qman33","email":"gotshogi@gmail.com"},{"name":"svjoshua","email":"jmoor@simpleviewinc.com"},{"name":"mkes99","email":"mike@formativewebsolutions.com"},{"name":"colin.booen","email":"colin.booen@simpleviewinc.com"},{"name":"ssmith_sv","email":"sean.smith@simpleviewinc.com"},{"name":"aglazebrook","email":"aglazebrook@simpleviewinc.com"},{"name":"rmaynes","email":"rmaynes@simpleviewinc.com"}],"homepage":"https://github.com/simpleviewinc/async-cron#readme","bugs":{"url":"https://github.com/simpleviewinc/async-cron/issues"},"dist":{"shasum":"8522194c0eda79eaa4b51dc9b020dca397ab7d5b","tarball":"https://registry.npmjs.org/@simpleview/async-cron/-/async-cron-0.0.2.tgz","fileCount":13,"integrity":"sha512-i4jWIvt+BQPGsIyJbuGHpIb7JRCCo/6+7lXLmZsut4Bztc+mxLyM7Wx+LG/URi53wtdZROs0U9VfRZWBNhSGAA==","signatures":[{"sig":"MEYCIQCXR47i6ZhmoRwtPu0C1mIcVn7q4WN6Ug3GmCZE6wzufQIhAJtZaYdFRrsVRVIrRYTDth6gUsxqVGfLaI5JvbCyQcc2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12002,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9zkoCRA9TVsSAnZWagAA9CUP/jiQl6iac0a+IT6ngXWL\ni1rkH3Q80mWNSIpzAQzPBFa4sui1WqR8r0z4y2ZMDsrZYJT8UKl/OeMadWhU\nwA7cNtJ3c1aYw+9+BcnQtw12DRFV7wypSwg/ZaNXGun+ljLugjQ0EEazspSz\nyUh+XyTqWL1Vf1uEjVc28WfefMywklIqwF5QTMBHI7QniCb4APRObrZuWBou\nQgjn06DRgez2nIpoPdH7Lo0JhHnYwOVobyaenDFn/N8G6zkA+++MQREFzEGb\nSDpPlKoGww5V/LyewlM5CSeIakIR4l3v/gIFEoReLSJVxzd1fptAkAxBUANv\n8PZ91goSQCqCXSFYyUTEe2aYgy6AsFFHOPRrrJgBiL0PubFtteWW9VZ/UHGw\npOLwp9OhP5S5PzThblZYcL85Tk62rsTB1Fs0niyef5x0DXx8E96s5FJbsP8A\ngJHUNUnp52fhuom2BsHqMlNUsmfIfvflabQkuekWaquNtHrzLnAsjnEMdt9z\n+01UJohjqplK3HN/5FspnvZNZV8bpxyFwPmFGaqANNzoOzj12b03U0BFYIjU\n3Wu+b5CvlRLeocpOAd0w7FYPQSGH9HH/NwVuizYa1Fs2H1TN8QbMg1Gu7Sp+\nPyZmpaFNOGn4bVCqVIJiz0Wkuqqr9phyb/gM48HfALEEkYUAVKTRIzptd2vE\nlG/C\r\n=Kknv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"75a1c47af4354ad000d93938f78a3d10bb4a1d6c","scripts":{"test":"mocha testing","docker":"./dev/build && ./dev/run || true","publish":"./dev/publish"},"_npmUser":{"name":"owenallenaz","email":"owenallenaz@gmail.com"},"repository":{"url":"git+https://github.com/simpleviewinc/async-cron.git","type":"git"},"_npmVersion":"6.13.4","description":"Async cron job runner using cron syntax","directories":{},"_nodeVersion":"12.14.1","dependencies":{"async-mutex":"0.3.1","cron-parser":"3.5.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"8.4.0","sinon":"11.1.1","@simpleview/mochalib":"1.0.2","@simpleview/assertlib":"1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/async-cron_0.0.2_1626814760704_0.4260456048912602","host":"s3://npm-registry-packages"}},"0.0.3-0":{"name":"@simpleview/async-cron","version":"0.0.3-0","author":{"name":"Owen Allen","email":"owenallenaz@gmail.com"},"license":"MIT","_id":"@simpleview/async-cron@0.0.3-0","maintainers":[{"name":"owenallenaz","email":"owenallenaz@gmail.com"},{"name":"qman33","email":"gotshogi@gmail.com"},{"name":"svjoshua","email":"jmoor@simpleviewinc.com"},{"name":"mkes99","email":"mike@formativewebsolutions.com"},{"name":"colin.booen","email":"colin.booen@simpleviewinc.com"},{"name":"ssmith_sv","email":"sean.smith@simpleviewinc.com"},{"name":"aglazebrook","email":"aglazebrook@simpleviewinc.com"},{"name":"rmaynes","email":"rmaynes@simpleviewinc.com"}],"homepage":"https://github.com/simpleviewinc/async-cron#readme","bugs":{"url":"https://github.com/simpleviewinc/async-cron/issues"},"dist":{"shasum":"256adfc735946ceef38640b29a4604c89c2869e1","tarball":"https://registry.npmjs.org/@simpleview/async-cron/-/async-cron-0.0.3-0.tgz","fileCount":13,"integrity":"sha512-vxRbF0C1n23LU6bEGrRlSAgRBXsclYOzAUhsGrn1dvyhUYVC4DNR9vF3AE3DOVo+U+NHVheFxuwtkIumMMUAzA==","signatures":[{"sig":"MEYCIQDbefPo31X6LjPeqXd8hGURESDWXwaIEQvuylFYV92DAAIhAMr52BTCP/HD99QJ2eYZ3fvWmtOjV1k4ayLk2Wp3tfde","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12710},"main":"src/index.js","gitHead":"ec50f76a21a7dcf234e4eb043efd08cad81b8bec","scripts":{"test":"mocha testing","docker":"./dev/build && ./dev/run || true","publish":"./dev/publish"},"_npmUser":{"name":"colin.booen","email":"colin.booen@simpleviewinc.com"},"repository":{"url":"git+https://github.com/simpleviewinc/async-cron.git","type":"git"},"_npmVersion":"6.13.4","description":"Async cron job runner using cron syntax","directories":{},"_nodeVersion":"12.14.1","dependencies":{"async-mutex":"0.3.1","cron-parser":"3.5.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"8.4.0","sinon":"11.1.1","@simpleview/mochalib":"1.0.2","@simpleview/assertlib":"1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/async-cron_0.0.3-0_1636734315025_0.8422827090534162","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@simpleview/async-cron","version":"0.1.0","author":{"name":"Owen Allen","email":"owenallenaz@gmail.com"},"license":"MIT","_id":"@simpleview/async-cron@0.1.0","maintainers":[{"name":"owenallenaz","email":"owenallenaz@gmail.com"},{"name":"qman33","email":"gotshogi@gmail.com"},{"name":"svjoshua","email":"jmoor@simpleviewinc.com"},{"name":"mkes99","email":"mike@formativewebsolutions.com"},{"name":"colin.booen","email":"colin.booen@simpleviewinc.com"},{"name":"ssmith_sv","email":"sean.smith@simpleviewinc.com"},{"name":"aglazebrook","email":"aglazebrook@simpleviewinc.com"},{"name":"rmaynes","email":"rmaynes@simpleviewinc.com"}],"homepage":"https://github.com/simpleviewinc/async-cron#readme","bugs":{"url":"https://github.com/simpleviewinc/async-cron/issues"},"dist":{"shasum":"53ed965a6301f6bd3a44209952e6cb1440ef9929","tarball":"https://registry.npmjs.org/@simpleview/async-cron/-/async-cron-0.1.0.tgz","fileCount":13,"integrity":"sha512-IG3QTnHVcOVvo+w4y+J59akSliU+eouV5gPtdtfRacWCUeTj+vkd4dfCzN2dC4PHOBw9pilT0xH22YdT7R9cPQ==","signatures":[{"sig":"MEUCICHp3Np5qKFGvbWulLaM4Iwu4/uO+o5QeymWmQJNom8gAiEA1IpQ4c9i9ZE1kn9LfC/2MRRLEZKsWKbI/c+82tBRWI4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12748,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2aqrCRA9TVsSAnZWagAA3YkP/3yjQEU/o4G0ya3yuOQ2\nY3ASdf/Bm72zASky1HxZDUtkiZ7SnfMztyGiosqBf9U/vpesL5WYZe7e6sZT\nr80aFPdPDgMgEEMfwhHBzkc0Q2Qr6DrN3pYgpeTAkM8ufGSJhAck2Pxu82Uz\na4fiUjbRwju2hT3uaGw2KxeLNChK80W7eTUrzAkVm3V4XxcJcCyhZ2PXUsiQ\ntIZrXeciecQZR601j4em+Y79K0Ibc/CAI8Tz/IqNj+jI56RTWIWlbeCV21Bf\nU/EtN2JQ4uPU0aIT4E0wzOjFfW0Qe6OkSzcuZZxbtB4KUO3SkChCQ2eI/1ZD\nUDq8Zmb7o1uocHwOFGsTfVRmIh9eNYTTBacbVNIdET3ywxqqsF5zOMlY54Qq\nfnTVSw7BgwYpauZr7H2hnUVe8ZYTq0X53uyk2cxpMuc5c+RIlYtyOa78DP6r\nuWvxd3FrK4jFQg8w+b0b2pROr+0y1MhVaK/+Jr6yMnG2UQx1X94pges84bZ0\nfkHGPd/zedkDSdsOpXTLYaqd1qUwLOqyp2SYJSur96sT6CvSlhQ5VVi69Yey\nzHMWzna9BJX5FBBqriztklSCFXJDSAPrVQ+rZEZKhOovxeyGWjQru12CLuSE\n1XOcm5cDyAwujVSq9N/tXHdnk149n2/D/LZ2cUHFGgf9WDPkQ0ycUx7r2Hrz\nOPnB\r\n=VeMf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","gitHead":"d54d856710f36e2a2785966b11222331545a14d8","scripts":{"test":"mocha testing","docker":"./dev/build && ./dev/run || true","publish":"./dev/publish"},"_npmUser":{"name":"owenallenaz","email":"owenallenaz@gmail.com"},"repository":{"url":"git+https://github.com/simpleviewinc/async-cron.git","type":"git"},"_npmVersion":"6.13.4","description":"Async cron job runner using cron syntax","directories":{},"_nodeVersion":"12.14.1","dependencies":{"async-mutex":"0.3.1","cron-parser":"3.5.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"8.4.0","sinon":"11.1.1","@simpleview/mochalib":"1.0.2","@simpleview/assertlib":"1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/async-cron_0.1.0_1637011328104_0.8642181448446786","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-07-20T20:59:20.634Z","modified":"2025-10-16T19:54:32.284Z","0.0.2":"2021-07-20T20:59:20.901Z","0.0.3-0":"2021-11-12T16:25:15.152Z","0.1.0":"2021-11-15T21:22:08.274Z"},"bugs":{"url":"https://github.com/simpleviewinc/async-cron/issues"},"author":{"name":"Owen Allen","email":"owenallenaz@gmail.com"},"license":"MIT","homepage":"https://github.com/simpleviewinc/async-cron#readme","repository":{"url":"git+https://github.com/simpleviewinc/async-cron.git","type":"git"},"description":"Async cron job runner using cron syntax","maintainers":[{"email":"owenallenaz@gmail.com","name":"owenallenaz"},{"email":"gotshogi@gmail.com","name":"qman33"},{"email":"jmoor@simpleviewinc.com","name":"svjoshua"},{"email":"george.batt@simpleviewinc.com","name":"georgeyb-sv"},{"email":"mike@formativewebsolutions.com","name":"mkes99"},{"email":"colin.booen@simpleviewinc.com","name":"colin.booen"},{"email":"sean.smith@simpleviewinc.com","name":"ssmith_sv"},{"email":"aglazebrook@simpleviewinc.com","name":"aglazebrook"},{"email":"rmaynes@simpleviewinc.com","name":"rmaynes"},{"email":"Michael.Harrington@simpleviewinc.com","name":"mikesan789"},{"email":"Kristian.Gonzalez@simpleviewinc.com","name":"kristian.gonzalez"},{"email":"paul.riding@simpleviewinc.com","name":"paul.riding"},{"email":"amir.muntasser@simpleviewinc.com","name":"arkmuntasser"},{"email":"ed.downard@simpleviewinc.com","name":"actionawesome"},{"email":"mcutshall0@gmail.com","name":"mcutshall"},{"email":"mikael.ramirez@simpleviewinc.com","name":"sv-mikael"},{"email":"kory.chinn@simpleviewinc.com","name":"korychinn_sv"},{"email":"dan-npmjs@dlford.io","name":"dlford"},{"email":"s.loutrel@gmail.com","name":"sloutrel"}],"readme":"# async-cron\nSimple cron job runner for Node that handles async functions and uses a `Mutex` that keeps the same job from running more than once simultaneously.\n\n# Installation\n\n```\nnpm install @simpleview/async-cron\n```\n\n# Example\n\n```js\nconst { Job } = require(\"@simpleview/async-cron\");\n\nconst job = new Job({\n\tschedule : \"*/5 * * * * *\"\n}, async function() {\n\tconst results = await doSomething();\n\treturn someResult;\n});\n\n// Required: Handle errors, or they will be black-holed resulting in not knowing that your crons are failing\njob.on(\"error\", function(e) {\n\tconsole.log(\"Cron Error\", e);\n});\n\n// Not required: if you care about the returned result from a cronJob, you can do something with it here\njob.on(\"result\", function(result) {\n\t\n});\n\n// Starts the job running the background\njob.start();\n```\n\n## Error Handling\n\nIf your job errors, the error will be blackholed unless you subscribe to the error handler.\n\n```js\njob.on(\"error\", function(e) {\n\t// do something with the error\n});\n```\n\nIf you want to differentiate errors from the job running from code errors, you can check the error `code`.\n\n```js\nconst { Job, E_RUNNING } = require(\"@simpleview/async-cron\");\n\nconst job = new Job(...args...);\n\njob.on(\"error\", function(e) {\n\tif (e.code === E_RUNNING) {\n\t\tconsole.log(\"Still running!\");\n\t} else {\n\t\tconsole.log(\"An actual code problem!\");\n\t}\n});\n```\n\n# Package API\n\n## Job\n\n`Job` represents a single cron job.\n\n* args\n\t* schedule - `string` - The schedule in [cron-parser](https://www.npmjs.com/package/cron-parser) syntax.\n* fn - `function` or `async function` - The function that will execute your job. It should either run fully synchronously, or be an async method/promise-based method. Do not utilize callbacks here, or else the async locking mechanism will not function properly. When this function returns, the job must be complete.\n\n### Job.start()\n\nStarts the job running in the background.\n\n### Job.stop()\n\nStops the job. This will not halt functions that are currently executing at this very moment, but it will present new runs from queuing up.\n\n### Job.run()\n\nManually executes the job. If the job errors, then this will throw, this includes throwing if the job is currently executing.\n\n```js\nconst result = await job.run();\n```\n\n### Job.isRunning()\n\nCheck if the job is currently running.\n\n```js\nconst isRunning = job.isRunning();\n```\n\n## E_RUNNING\n\nSymbol reference for `error.code` when an `Error` is thrown due to an a job already running. See error handling.","readmeFilename":"README.md"}