{"id":14969178,"url":"https://github.com/fastify/fastify-schedule","last_synced_at":"2025-05-16T08:03:57.135Z","repository":{"id":36990010,"uuid":"330802470","full_name":"fastify/fastify-schedule","owner":"fastify","description":"Fastify plugin for scheduling periodic jobs","archived":false,"fork":false,"pushed_at":"2025-05-01T00:32:57.000Z","size":130,"stargazers_count":101,"open_issues_count":1,"forks_count":15,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-05-01T01:30:56.956Z","etag":null,"topics":["fastify","fastify-plugin"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@fastify/schedule","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fastify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fastify","open_collective":"fastify"}},"created_at":"2021-01-18T22:32:14.000Z","updated_at":"2025-05-01T00:32:55.000Z","dependencies_parsed_at":"2023-01-17T12:00:41.373Z","dependency_job_id":"572e1b66-edfb-4bcf-a5ef-550a5ce64905","html_url":"https://github.com/fastify/fastify-schedule","commit_stats":{"total_commits":124,"total_committers":16,"mean_commits":7.75,"dds":0.5,"last_synced_commit":"c987f226adf52714498a4081c522f257c4e96c95"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-schedule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-schedule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-schedule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-schedule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fastify","download_url":"https://codeload.github.com/fastify/fastify-schedule/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493380,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastify","fastify-plugin"],"created_at":"2024-09-24T13:41:17.722Z","updated_at":"2025-05-16T08:03:57.064Z","avatar_url":"https://github.com/fastify.png","language":"JavaScript","readme":"# @fastify/schedule\n\n[![CI](https://github.com/fastify/fastify-schedule/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-schedule/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/@fastify/schedule.svg?style=flat)](https://www.npmjs.com/package/@fastify/schedule)\n[![NPM downloads](https://img.shields.io/npm/dm/@fastify/schedule.svg?style=flat)](https://www.npmjs.com/package/@fastify/schedule)\n[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)\n\nFastify plugin for scheduling periodic jobs. Provides an instance of [toad-scheduler](https://github.com/kibertoad/toad-scheduler) on fastify instance.\nJobs are stopped automatically when the fastify instance is stopped.\n\n## Getting started\n\nFirst install the package:\n\n```bash\nnpm i @fastify/schedule toad-scheduler\n```\n\nNext, set up the plugin:\n\n```js\nconst fastify = require('fastify')();\nconst { fastifySchedule } = require('@fastify/schedule');\nconst { SimpleIntervalJob, AsyncTask } = require('toad-scheduler');\n\nconst task = new AsyncTask(\n    'simple task',\n    () =\u003e { return db.pollForSomeData().then((result) =\u003e { /* continue the promise chain */ }) },\n    (err) =\u003e { /* handle errors here */ }\n)\nconst job = new SimpleIntervalJob({ seconds: 20, }, task)\n\nfastify.register(fastifySchedule);\n\n// `fastify.scheduler` becomes available after initialization.\n// Therefore, you need to call `ready` method.\nfastify.ready().then(() =\u003e {\n    fastify.scheduler.addSimpleIntervalJob(job)\n})\n```\n\nFor more detailed instructions, see the [documentation](https://github.com/kibertoad/toad-scheduler) of `toad-scheduler`.\n","funding_links":["https://github.com/sponsors/fastify","https://opencollective.com/fastify"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastify%2Ffastify-schedule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffastify%2Ffastify-schedule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastify%2Ffastify-schedule/lists"}