Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to manage schedulers programmatically in a web environment #8

Open
h25302 opened this issue Mar 2, 2024 · 2 comments
Open

How to manage schedulers programmatically in a web environment #8

h25302 opened this issue Mar 2, 2024 · 2 comments

Comments

@h25302
Copy link

h25302 commented Mar 2, 2024

I want to adjust parameters programmatically and run and stop the scheduler at (environment: ['web'])

@KABBOUCHI
Copy link
Owner

KABBOUCHI commented Mar 2, 2024

you can access the scheduler instance, and modify/add wtvr u want here

import scheduler from 'adonisjs-scheduler/services/main'

scheduler.command("inspire").everyFiveSeconds();

scheduler.items // u can access all added commands here

and probably u need a custom logic, check how its done here https://github.com/KABBOUCHI/adonisjs-scheduler/blob/master/commands/scheduler_command.ts

@h25302
Copy link
Author

h25302 commented Mar 3, 2024

How can I stop and start (scheduler.items|item) programmatically

Similar to the following:
scheduler.stopAll()
scheduler.runAll()
scheduler.item[0].stop()
scheduler.item[0].run()
scheduler.item[0].delete()

Thank you very much, @KABBOUCHI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants