Skip to content

Add timepoint to periodic task settings. #913

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vazgmik
Copy link

@vazgmik vazgmik commented Apr 16, 2025

Relates #895


Note: by creating a PR or an issue you automatically agree to the CLA. See CONTRIBUTING.md. Feel free to remove this note, the agreement holds.

@vazgmik vazgmik force-pushed the 895-feat-pt-time-point branch 2 times, most recently from 6731cd2 to ed36286 Compare April 22, 2025 06:54
@vazgmik vazgmik force-pushed the 895-feat-pt-time-point branch from ed36286 to b6ee85c Compare May 2, 2025 16:35
@vazgmik vazgmik force-pushed the 895-feat-pt-time-point branch from b6ee85c to e39b5f0 Compare May 13, 2025 17:41
@@ -62,6 +62,15 @@ class PeriodicTask final {

/// Configuration parameters for PeriodicTask.
struct Settings final {
struct TimePoint {
std::uint8_t hour;
std::uint8_t minute;
Copy link
Collaborator

Choose a reason for hiding this comment

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

если есть что-то про время, должно быть и про таймзону

@@ -62,6 +62,15 @@ class PeriodicTask final {

/// Configuration parameters for PeriodicTask.
struct Settings final {
struct TimePoint {
std::uint8_t hour;
std::uint8_t minute;
Copy link
Collaborator

Choose a reason for hiding this comment

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

лучше инициализировать нулями, чем оставлять мусорные значения

@@ -110,6 +125,10 @@ class PeriodicTask final {
/// `(period +/- distribution) - time of previous execution`
std::chrono::milliseconds distribution{};

/// @brief Time point for the task execution. Task is repeated every
/// hour:minute UTC of the current/next day
std::optional<TimePoint> strong_mode_anchor;
Copy link
Collaborator

Choose a reason for hiding this comment

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

как-то костыльненько выглядит
у нас есть параметры внутри Settings, и тут они частично переопределяются
лучше написать отдельный класс, который работает по расписанию и не обладает инвариантами PeriodicTask

@vazgmik vazgmik force-pushed the 895-feat-pt-time-point branch from e39b5f0 to 248e505 Compare May 15, 2025 10:49
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.

2 participants