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

refactor: use aiocron for better scheduling of the function #39

Merged
merged 2 commits into from Oct 28, 2022
Merged

refactor: use aiocron for better scheduling of the function #39

merged 2 commits into from Oct 28, 2022

Conversation

thenishantsapkota
Copy link
Contributor

No description provided.

@thenishantsapkota
Copy link
Contributor Author

Fixes #26

@thenishantsapkota
Copy link
Contributor Author

@diwash007 @hitblast Will it be good if I ran it in the end of every month i.e. 30th?
I currently am scheduling it at 1st of every month at 00:00

Copy link
Collaborator

@hitblast hitblast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help!

@hitblast
Copy link
Collaborator

@diwash007 @hitblast Will it be good if I ran it in the end of every month i.e. 30th?
I currently am scheduling it at 1st of every month at 00:00

First seems more logical.

@thenishantsapkota
Copy link
Contributor Author

@diwash007 @hitblast Will it be good if I ran it in the end of every month i.e. 30th?
I currently am scheduling it at 1st of every month at 00:00

First seems more logical.

Ok then, I'll schedule it for 30th of every month at 00:00
Will that be okay?

Run the required functions in order for the bot.
"""
@staticmethod
@aiocron.crontab("0 0 1 * *")
Copy link
Collaborator

@diwash007 diwash007 Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where you are using the environment variable TIME_PERIOD_DAYS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well we don't need the environment variable do we if we schedule it at the first of every month?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not making it to run every month .. It is flexible
we can set it to every day, week, month, fortnight, year, decade, whatever :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not making it to run every month .. It is flexible we can set it to every day, week, month, fortnight, year, decade, whatever :D

Gotcha captain ✌️

@diwash007
Copy link
Collaborator

The bot is flexible with timing.

@hitblast
Copy link
Collaborator

hitblast commented Oct 28, 2022

@diwash007 @hitblast Will it be good if I ran it in the end of every month i.e. 30th?
I currently am scheduling it at 1st of every month at 00:00

First seems more logical.

Ok then, I'll schedule it for 30th of every month at 00:00 Will that be okay?

Could you, instead of setting it to the end of every month at 00:00, set it to the end of every n number of days? (refer to @diwash007 in this case)

@thenishantsapkota
Copy link
Contributor Author

I'll just use the TIME_PERIOD_DAYS in place of the cron's Day argument
Example:
Instead of this

@aiocron.crontab("0 0 1 * *")

I'll do something like

@aiocron.crontab(f"0 0 {global_.TIME_PEROID_DAYS} * *")

Will that be okay?

@hitblast
Copy link
Collaborator

I'll just use the TIME_PERIOD_DAYS in place of the cron's Day argument Example: Instead of this

@aiocron.crontab("0 0 1 * *")

I'll do something like

@aiocron.crontab(f"0 0 {global_.TIME_PEROID_DAYS} * *")

Will that be okay?

Looks good! Also, there's a small typo if you've noticed :D

@diwash007
Copy link
Collaborator

aicron.

I'll just use the TIME_PERIOD_DAYS in place of the cron's Day argument Example: Instead of this

@aiocron.crontab("0 0 1 * *")

I'll do something like

@aiocron.crontab(f"0 0 {global_.TIME_PEROID_DAYS} * *")

Will that be okay?

Looks Good

@thenishantsapkota
Copy link
Contributor Author

I'll just use the TIME_PERIOD_DAYS in place of the cron's Day argument Example: Instead of this

@aiocron.crontab("0 0 1 * *")

I'll do something like

@aiocron.crontab(f"0 0 {global_.TIME_PEROID_DAYS} * *")

Will that be okay?

Looks good! Also, there's a small typo if you've noticed :D

😝

@diwash007 diwash007 merged commit 2d6e3f5 into HackSquadDev:main Oct 28, 2022
@thenishantsapkota thenishantsapkota deleted the feat/aiocron branch October 30, 2022 05:06
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

Successfully merging this pull request may close these issues.

None yet

3 participants