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: simplify debug logging for app readiness checks #520

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

DiscreteTom
Copy link

Description of changes:
Simplify debug logging for app readiness checks to prevent abusing the logs. Move the original "app is not ready" to the trace log level.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@DiscreteTom DiscreteTom requested a review from a team as a code owner October 9, 2024 07:38
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@mxfactorial
Copy link
Contributor

easier to test

struct Checkpoint {
    start: Instant,
    interval: i32,
    next: i32,
};

impl Checkpoint {
    fn new() -> Checkpoint {
        let interval: i32 = 2;
        let start = Instant::now();
        Checkpoint {
            start,
            interval,
            next: start.elapsed().as_secs() as i32 + interval,
        }
    }

    fn increment(&mut self) {
        self.next += self.interval;
    }

    fn lapsed(&self) -> bool {
        if self.start.elapsed().as_secs() as i32 >= self.next {
            true
        } else {
            false
        }
    }
}

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.

3 participants