-
Notifications
You must be signed in to change notification settings - Fork 0
Huey schdule fixes and test uniformization #24
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
Conversation
Herklos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| assert task_result == expected_result | ||
| if encrypted_result: | ||
| assert isinstance(json.loads(result[octobot_node.app.enums.TaskResultKeys.METADATA.value]), dict) | ||
| assert result[octobot_node.app.enums.TaskResultKeys.METADATA.value] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice tests!
| next_execution_time = next_actions_description.get_next_execution_time() | ||
| now_time = time.time() | ||
| if next_execution_time == 0 or next_execution_time < now_time: | ||
| delay = 0 | ||
| else: | ||
| next_execution_time = datetime.datetime.fromtimestamp( | ||
| next_actions_description.get_next_execution_time(), | ||
| tz=datetime.timezone.utc | ||
| ) | ||
| execute_octobot.schedule(args=[task], eta=next_execution_time) | ||
| delay = next_execution_time - now_time | ||
| logging.getLogger("octobot_node.scheduler.tasks").info( | ||
| f"Scheduling task '{task.name}' for execution in {delay} seconds" | ||
| ) | ||
| return execute_octobot.schedule(args=[task], delay=delay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
octobot_node/scheduler/scheduler.py
Outdated
| elif settings.USE_MEMORY_SCHEDULER: | ||
| # warning: this mode has no persistence, tasks will be lost when the process is stopped | ||
| self.logger.info("Initializing scheduler with memory backend") | ||
| self.INSTANCE = MemoryHuey(DEFAULT_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use something like an init arg or class global variable to set this value if users shouldn't use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now disabled, we now use sqlitehuey in tests
Herklos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.