How does everyone start jobs?


#1

In my implementation I have been creating simple generic http handlers to create new jobs and set the cron schedule parameters. Over time I have multiple jobs and its getting a bit cumbersome. Would be interested how people may have made this easier who manage a lot of jobs. Thanks !


#2

What I did is that my controller which listens for requests simply handles the request and persists the info in our DB. I have a recurring task that runs on its own every minute and queries the DB for any jobs that need to be run. It finds them and runs as many tasks as there are requests since the last run. In order to get around the hangfire limitation that 1 minute is the smallest interval between scheduled runs, when I receive a request for a job, I trigger the recurring task once I’ve persisted the request. What’s nice about it is that if it is already running it won’t do it again.