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

chore: don't message if Rover is already up to date #342

Merged
merged 1 commit into from
Mar 18, 2021

Conversation

EverlastingBugstopper
Copy link
Contributor

cc @JakeDawkins on this one - felt a bit weird to have a message telling you you're up to date. I feel like it's OK to just remain silent in that case. What do you think?

@JakeDawkins
Copy link
Contributor

@EverlastingBugstopper Hmm, I agree for the automatic checks, I didn't think of that. This is also used by rover update check though, so in that case, we should have some printout, right? Maybe this update checker could return a value that could be ignored for the automatic checks and used by the check command, so the check command prints that you're up to date?

@EverlastingBugstopper
Copy link
Contributor Author

that sure does sound like a better approach!

@EverlastingBugstopper EverlastingBugstopper force-pushed the avery/remove-rover-update-msg branch 2 times, most recently from 5c04dac to 3ac24de Compare March 17, 2021 18:28
@EverlastingBugstopper
Copy link
Contributor Author

ok @JakeDawkins this is ready for re-review

Comment on lines 30 to 42
if is_foreground || last_checked_time.is_none() {
do_update_check(&mut checked, is_foreground)?;
} else if let Some(last_checked_time) = last_checked_time {
let time_since_check = current_time.duration_since(last_checked_time)?.as_secs();
tracing::debug!(
"Time since last update check: {:?}h",
time_since_check / ONE_HOUR
);

if force || time_since_check > ONE_DAY {
do_update_check(&mut checked)?;
} else {
tracing::debug!(
"No need to check for updates. Automatic checks happen once per day"
);
}
}
// we haven't checked for updates before -- check now :)
None => {
do_update_check(&mut checked)?;
if time_since_check > ONE_DAY {
do_update_check(&mut checked, is_foreground)?;
} else {
tracing::debug!("No need to check for updates. Automatic checks happen once per day");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i restructured this to try to make it a bit more readable - let me know if you think it has the opposite effect!

/// If `force` is not passed, we check for updates every day at most
pub fn check_for_update(config: config::Config, force: bool) -> Result<()> {
/// If `is_foreground` is not passed, we check for updates every day at most
pub fn check_for_update(config: config::Config, is_foreground: bool) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love the is_foreground name. It sounds less obvious what's going on than force imho. But I won't block on that at all :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mmm - i'll switch it back.

@EverlastingBugstopper EverlastingBugstopper merged commit 1ada0c6 into main Mar 18, 2021
@EverlastingBugstopper EverlastingBugstopper deleted the avery/remove-rover-update-msg branch March 18, 2021 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants