{"id":16994205,"url":"https://github.com/xstoudi/adonis-scheduler","last_synced_at":"2025-04-12T05:08:37.212Z","repository":{"id":65561374,"uuid":"586330071","full_name":"Xstoudi/adonis-scheduler","owner":"Xstoudi","description":"Unopinionated scheduler for Adonis","archived":false,"fork":false,"pushed_at":"2023-05-11T15:20:01.000Z","size":763,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T11:49:30.633Z","etag":null,"topics":["adonis","adonis5","adonisjs","adonisjs5","cron","schedule","scheduler","task"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Xstoudi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-07T18:47:27.000Z","updated_at":"2025-01-07T03:54:24.000Z","dependencies_parsed_at":"2023-02-08T20:16:31.290Z","dependency_job_id":null,"html_url":"https://github.com/Xstoudi/adonis-scheduler","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xstoudi%2Fadonis-scheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xstoudi%2Fadonis-scheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xstoudi%2Fadonis-scheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xstoudi%2Fadonis-scheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xstoudi","download_url":"https://codeload.github.com/Xstoudi/adonis-scheduler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519545,"owners_count":21117761,"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":["adonis","adonis5","adonisjs","adonisjs5","cron","schedule","scheduler","task"],"created_at":"2024-10-14T03:44:54.252Z","updated_at":"2025-04-12T05:08:37.183Z","avatar_url":"https://github.com/Xstoudi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/2575182/236929207-c76d0ae4-5a6f-4951-b452-db1440edb0e7.png\" /\u003e\n  \u003ch3\u003e@stouder-io/adonis-scheduler\u003c/h3\u003e\n  \u003cp\u003eUnopinionated scheduler for Adonis\u003c/p\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@stouder-io/adonis-scheduler\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@stouder-io/adonis-scheduler.svg?style=for-the-badge\u0026logo=npm\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/@stouder-io/adonis-scheduler?color=blueviolet\u0026style=for-the-badge\" /\u003e\n  \u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dt/@stouder-io/adonis-scheduler?style=for-the-badge\"\u003e\n\u003c/div\u003e\n\n## Installation\nThis package is available in the npm registry.\n```\nnpm i @stouder-io/adonis-scheduler\n```\n\nNext, configure the package by running the following command.\n```\nnode ace configure @stouder-io/adonis-scheduler\n```\n\n## Usage\nThe scheduler will start with your Adonis server, but no task is loaded.\n\nTo create a task, run the following command.\n```\nnode ace make:task MyFirstTask\n```\n\nThis will create the following file under `app/Tasks` directory:\n```ts\nimport { TaskContract } from '@ioc:StouderIO/Scheduler'\n\nexport default class MyFirstTask implements TaskContract {\n  public readonly name: string = '{{ name }}'\n  public readonly cron: string = '* * * * *'\n\n  public async run(): Promise\u003cvoid\u003e {\n    \n  }\n}\n```\n\nThe `run` method is called when the scheduler run the task according to the cron expression you configure in the `cron` field. `name` is just for internal use, but it must be unique.\n\nPlease note that running CPU-intensive operations in the task has the potential to block your full web application as Node.js is single-threaded.\n\nIf you need to run high-intensive CPU task, you could run an Ace command using `execa`, for example:\n```ts\nimport { TaskContract } from '@ioc:StouderIO/Scheduler'\nimport execa from 'execa'\n\nexport default class MyFirstTask implements TaskContract {\n  public readonly name: string = 'test-task'\n  public readonly cron: string = '* * * * *'\n\n  public async run(): Promise\u003cvoid\u003e {\n    // will execute `node ace intensive` every minute\n    execa.node('ace', ['intensive'], { stdio: 'inherit' })\n  }\n}\n```\n\nAlso, if you run multiple instances of your Adonis application, the tasks will be ran on each instance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxstoudi%2Fadonis-scheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxstoudi%2Fadonis-scheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxstoudi%2Fadonis-scheduler/lists"}