cfurst/CronJobManager

can you add some functionality like this : get and show cron list by username

Closed this issue ยท 6 comments

can you add some functionality like this : get and show cron list by username

Can you provide a little more detail as to what you mean.. You are also free to submit a pull request with this functionality.

Can you provide a little more detail as to what you mean.. You are also free to submit a pull request with this functionality.

get a cron list with usernames like this:

{
   "alexdkontol": {
         // cron list
   },
   "mariasharapova": {
         // cron list
   },
   "DonaldTrump": {
         // cron list
    }
}

@nancysavchenkoo I think that such a feature should belong to your project, but not this package, to not pollute it.

It seems that all you want/need is a way to manage Cron Jobs per account. I would say that you can easily do that if, in your project, you create a CronJobManager per user, or, better yet, if the keys have the username associated to it, such as: mariasharapova-cronjobsthatdoesx. In sum, your key could be composed of: `${username}-${cronjob}`.

@nancysavchenkoo I think that such a feature should belong to your project, but not this package, to not pollute it.

It seems that all you want/need is a way to manage Cron Jobs per account. I would say that you can easily do that if, in your project, you create a CronJobManager per user, or, better yet, if the keys have the username associated to it, such as: mariasharapova-cronjobsthatdoesx. In sum, your key could be composed of: `${username}-${cronjob}`.

can you help me simple code as you mean

can you help me simple code as you mean

@nancysavchenkoo sure. So, lets assume you are creating cron jobs like the readme proposes. If you decide to have one CronJobManager per user you can simply do the following:

var users = {};
users['mariasharapova'] = new CronJobManager('job-key', '30 * * * * *', taskFunction);

As such, when you ask for users['mariasharapova'].listCrons() or just users['mariasharapova'] you will get the cron list that you want.

can you help me simple code as you mean

@nancysavchenkoo sure. So, lets assume you are creating cron jobs like the readme proposes. If you decide to have one CronJobManager per user you can simply do the following:

var users = {};
users['mariasharapova'] = new CronJobManager('job-key', '30 * * * * *', taskFunction);

As such, when you ask for users['mariasharapova'].listCrons() or just users['mariasharapova'] you will get the cron list that you want.

thanks for the help, this really helped me