diff options
| author | seth <[email protected]> | 2024-10-12 09:27:07 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-10-12 09:27:07 -0400 |
| commit | 7ff741ab80f2cc6aec658be633ca6a5a5a0ff5cc (patch) | |
| tree | e045f0a3cfc6f60e8957723eb392b0e6442bf642 /crates/discord-bot/src/commands/track.rs | |
| parent | a7e61f884b96d6140778bf2fcfa4d15d288011f8 (diff) | |
discord-bot: track branch check time
Diffstat (limited to 'crates/discord-bot/src/commands/track.rs')
| -rw-r--r-- | crates/discord-bot/src/commands/track.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/discord-bot/src/commands/track.rs b/crates/discord-bot/src/commands/track.rs index 0f0e0be..0ae98c4 100644 --- a/crates/discord-bot/src/commands/track.rs +++ b/crates/discord-bot/src/commands/track.rs @@ -1,11 +1,13 @@ use crate::{config::Config, http::GitHubClientExt}; use std::sync::Arc; +use std::time::Instant; use eyre::Result; use log::debug; use serenity::builder::{ - CreateCommand, CreateCommandOption, CreateEmbed, CreateInteractionResponseFollowup, + CreateCommand, CreateCommandOption, CreateEmbed, CreateEmbedFooter, + CreateInteractionResponseFollowup, }; use serenity::model::{ application::{ @@ -71,7 +73,9 @@ where }; let repository = config.repository(); + let timer = Instant::now(); let branch_results = repository.branches_contain_sha(config.nixpkgs_branches(), &commit_sha)?; + let branch_check_time = timer.elapsed(); let fields: Vec<_> = branch_results .iter() .map(|(name, has_commit)| { @@ -93,7 +97,11 @@ where .title(format!("Nixpkgs PR #{} Status", pull_request.number)) .url(&pull_request.html_url) .description(&pull_request.title) - .fields(fields); + .fields(fields) + .footer(CreateEmbedFooter::new(format!( + "Completed in {}ms", + branch_check_time.as_millis() + ))); if let Some(merged_at) = pull_request.merged_at { if let Ok(timestamp) = Timestamp::parse(&merged_at) { |
