Skip to content

Refactor time.rs to make the code logic the same as others.#347

Merged
estk merged 1 commit intoestk:mainfrom
Dirreke:refactor-timetrigger
May 27, 2025
Merged

Refactor time.rs to make the code logic the same as others.#347
estk merged 1 commit intoestk:mainfrom
Dirreke:refactor-timetrigger

Conversation

@Dirreke
Copy link
Copy Markdown
Contributor

@Dirreke Dirreke commented Feb 11, 2024

  • Delete struct TimeTriggerConfig for lib without config_parsing feature.
  • Transfer time trigger initialization to the first trigger() execution

@Dirreke Dirreke requested review from estk and gadunga as code owners February 11, 2024 16:55
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 11, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 9.09091% with 20 lines in your changes missing coverage. Please review.

Project coverage is 61.60%. Comparing base (8ab1b34) to head (04d5d08).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...ppend/rolling_file/policy/compound/trigger/time.rs 9.09% 20 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #347      +/-   ##
==========================================
- Coverage   63.39%   61.60%   -1.80%     
==========================================
  Files          24       25       +1     
  Lines        1557     1625      +68     
==========================================
+ Hits          987     1001      +14     
- Misses        570      624      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@gauntl3t12 gauntl3t12 left a comment

Choose a reason for hiding this comment

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

Couple questions, but otherwise looks good

Comment thread src/append/rolling_file/policy/compound/trigger/time.rs
Comment thread src/append/rolling_file/policy/compound/trigger/time.rs
@gauntl3t12
Copy link
Copy Markdown
Contributor

gauntl3t12 commented Feb 16, 2024 via email

gauntl3t12
gauntl3t12 previously approved these changes Feb 16, 2024
gauntl3t12
gauntl3t12 previously approved these changes Mar 8, 2024
@gauntl3t12
Copy link
Copy Markdown
Contributor

Looks like chronic changed their time interface. Can you fix that well you're already in there for this PR? @Dirreke

@Dirreke
Copy link
Copy Markdown
Contributor Author

Dirreke commented Mar 9, 2024

Which choice do you prefer if the duration time as millis exceed i64::MAX?
return panic? or just use i64::MAX.

@gauntl3t12
Copy link
Copy Markdown
Contributor

Let’s return an error, similar to how the size trigger does it

@Dirreke Dirreke force-pushed the refactor-timetrigger branch from eb9a7bd to 1db6e18 Compare March 9, 2024 16:25
@Dirreke
Copy link
Copy Markdown
Contributor Author

Dirreke commented Mar 9, 2024

I will fix it tomorrow.

@Dirreke Dirreke force-pushed the refactor-timetrigger branch from 1db6e18 to 0b8f045 Compare March 10, 2024 04:09
Copy link
Copy Markdown
Contributor

@gauntl3t12 gauntl3t12 left a comment

Choose a reason for hiding this comment

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

Please make sure to bump the minimum required chrono.

Comment thread src/append/rolling_file/policy/compound/trigger/time.rs Outdated
@Dirreke Dirreke force-pushed the refactor-timetrigger branch from 1db83e0 to df5e6a5 Compare March 11, 2024 06:08
gauntl3t12
gauntl3t12 previously approved these changes Mar 12, 2024
Copy link
Copy Markdown
Contributor

@gauntl3t12 gauntl3t12 left a comment

Choose a reason for hiding this comment

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

Great work! 🎉

@Hellager
Copy link
Copy Markdown

Is there any progress about this PR?

@gauntl3t12
Copy link
Copy Markdown
Contributor

I’m communicating with the repo owner to get this merged in. It’s g2g from me.

@Hellager
Copy link
Copy Markdown

Got it, hopes it will be soon and thanks for your great work.

Comment thread src/append/rolling_file/policy/compound/trigger/time.rs
Comment thread src/append/rolling_file/policy/compound/trigger/time.rs Outdated
Comment thread src/append/rolling_file/policy/compound/trigger/time.rs
Comment thread src/append/rolling_file/policy/compound/trigger/time.rs Outdated
Comment thread src/append/rolling_file/policy/compound/trigger/time.rs Outdated
@estk
Copy link
Copy Markdown
Owner

estk commented Apr 1, 2024

Wondering the reason for this:

Transfer time trigger initialization to the first trigger() execution

@Dirreke
Copy link
Copy Markdown
Contributor Author

Dirreke commented Apr 1, 2024

If we build it in program instead of config file, we have to build TimeTrigger first before initiating builder. The time recorded should be the time when the first log message is written but not the time when TimeTrigger be built.
Another reason is just that I want to keep it the same as the onstartup trigger.

@Dirreke Dirreke force-pushed the refactor-timetrigger branch from df5e6a5 to 0e56e18 Compare April 1, 2024 17:26
@Dirreke Dirreke force-pushed the refactor-timetrigger branch 3 times, most recently from e475695 to d0d35b8 Compare April 2, 2024 10:57
@carlocorradini
Copy link
Copy Markdown

Awesome, any update? 🥳

@gauntl3t12
Copy link
Copy Markdown
Contributor

@carlocorradini The owner of the repo requested that we break up this PR into separate pieces.

  1. Fix the deprecated API fix: replace deprecated API in chrono 0.4.35 for converting to time #367. This is waiting on getting the owners time again to review.
  2. Move when the trigger is initialized.
  3. Refactor the code to include making the config field public.

This will allow the changes to be analyzed independently and makes the impact of each change more easily tracked. @Dirreke Have you been able to work on breaking number 2 out into a separate PR?

@Dirreke
Copy link
Copy Markdown
Contributor Author

Dirreke commented Apr 18, 2024

Thanks for that. However, I'm a little busy these days. Maybe I will do it next week. Or maybe I can rebase it after #367 merged

@carlocorradini
Copy link
Copy Markdown

Firstly, awesome 😎
And... What do you think if we use the builder pattern to populate the fields in config?

@Dirreke
Copy link
Copy Markdown
Contributor Author

Dirreke commented May 3, 2024

2. Move when the trigger is initialized.

Task 2 has a lot of code related to task 1. I'd like to finish it after #367 is merged.

For Issue #370, I open #372 to provide a quick PR to solve it.

@estk
Copy link
Copy Markdown
Owner

estk commented May 26, 2025

@Dirreke can you please rebase this on main

@Dirreke
Copy link
Copy Markdown
Contributor Author

Dirreke commented May 26, 2025

Of course. I'll do it later today.

@Dirreke Dirreke force-pushed the refactor-timetrigger branch 3 times, most recently from 719ec93 to eaf02c3 Compare May 27, 2025 06:23
@estk estk force-pushed the refactor-timetrigger branch from eaf02c3 to 04d5d08 Compare May 27, 2025 21:20
@estk estk merged commit 0b1b816 into estk:main May 27, 2025
12 checks passed
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.

6 participants