Skip to content

Commit

Permalink
ingres: poll: do not poll before notifying systemd
Browse files Browse the repository at this point in the history
We poll each user, repository, run and job in sequence.
This can take rather long when a lot of repositories are configured,
in fact too long for the default systemd job startup timeout.

There is no real benefit to delaying the startup notification until after
the first of polling, so just don't do it instead.
This speeds up the perceived startup a lot.
  • Loading branch information
hnez committed Aug 27, 2024
1 parent 1b5fa6f commit 1b76a0f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion src/ingres/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Poller {
/// How far back to go in the run history is decided by `MAX_NEW_RUN_AGE`,
/// the most recent run id already known for the repository and the list
/// of runs the `create::jobs::Manager` is interested in.
pub async fn poll_once(&self) -> octocrab::Result<()> {
async fn poll_once(&self) -> octocrab::Result<()> {
let cfg = self.config.get();

// These are runs for which we have jobs in "interesting" states,
Expand Down
4 changes: 0 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ async fn forrest() -> anyhow::Result<()> {
// missed webhooks.
let poller = ingres::Poller::new(config.clone(), auth.clone(), job_manager);

// Make sure we can reach GitHub and our authentication works before
// signaling readiness to systemd.
poller.poll_once().await?;

log::info!("Startup complete. Handling requests");

// Notify systemd that we are ready to handle requests.
Expand Down

0 comments on commit 1b76a0f

Please sign in to comment.