mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-11-24 18:41:06 +00:00
Downgrade some WARN logs to INFO, update docs for public methods
This commit is contained in:
parent
01cbe34ac3
commit
47751f3875
3 changed files with 18 additions and 15 deletions
|
@ -1961,6 +1961,10 @@ impl PictRsConfiguration {
|
|||
Ok(self)
|
||||
}
|
||||
|
||||
/// Install the configured pict-rs metrics collector
|
||||
///
|
||||
/// This is a no-op if pict-rs is not configured to export metrics. Applications that register
|
||||
/// their own metrics collectors shouldn't call this method.
|
||||
pub fn install_metrics(self) -> color_eyre::Result<Self> {
|
||||
if let Some(addr) = self.config.metrics.prometheus_address {
|
||||
PrometheusBuilder::new()
|
||||
|
@ -1972,9 +1976,6 @@ impl PictRsConfiguration {
|
|||
}
|
||||
|
||||
/// Run the pict-rs application
|
||||
///
|
||||
/// This must be called after `init_config`, or else the default configuration builder will run and
|
||||
/// fail.
|
||||
pub async fn run(self) -> color_eyre::Result<()> {
|
||||
let PictRsConfiguration { config, operation } = self;
|
||||
|
||||
|
|
|
@ -98,7 +98,9 @@ where
|
|||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
match self.as_mut().project() {
|
||||
InternalFutureProj::Internal { future } => future.poll(cx),
|
||||
InternalFutureProj::Error { error } => Poll::Ready(Err(error.take().unwrap().into())),
|
||||
InternalFutureProj::Error { error } => {
|
||||
Poll::Ready(Err(error.take().expect("Polled after completion").into()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ const GENERATOR_KEY: &str = "last-path";
|
|||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn migrate_repo(old_repo: ArcRepo, new_repo: ArcRepo) -> Result<(), Error> {
|
||||
tracing::warn!("Running checks");
|
||||
tracing::info!("Running checks");
|
||||
if let Err(e) = old_repo.health_check().await {
|
||||
tracing::warn!("Old repo is not configured correctly");
|
||||
return Err(e.into());
|
||||
|
@ -32,8 +32,8 @@ pub(crate) async fn migrate_repo(old_repo: ArcRepo, new_repo: ArcRepo) -> Result
|
|||
|
||||
let total_size = old_repo.size().await?;
|
||||
let pct = (total_size / 100).max(1);
|
||||
tracing::warn!("Checks complete, migrating repo");
|
||||
tracing::warn!("{total_size} hashes will be migrated");
|
||||
tracing::info!("Checks complete, migrating repo");
|
||||
tracing::info!("{total_size} hashes will be migrated");
|
||||
|
||||
let hash_stream = std::pin::pin!(old_repo.hashes());
|
||||
let mut hash_stream = hash_stream.into_streamer();
|
||||
|
@ -51,7 +51,7 @@ pub(crate) async fn migrate_repo(old_repo: ArcRepo, new_repo: ArcRepo) -> Result
|
|||
if index % pct == 0 {
|
||||
let percent = index / pct;
|
||||
|
||||
tracing::warn!("Migration {percent}% complete - {index}/{total_size}");
|
||||
tracing::info!("Migration {percent}% complete - {index}/{total_size}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ pub(crate) async fn migrate_repo(old_repo: ArcRepo, new_repo: ArcRepo) -> Result
|
|||
.await?;
|
||||
}
|
||||
|
||||
tracing::warn!("Migration complete");
|
||||
tracing::info!("Migration complete");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ pub(crate) async fn migrate_04<S: Store + 'static>(
|
|||
store: S,
|
||||
config: Configuration,
|
||||
) -> Result<(), Error> {
|
||||
tracing::warn!("Running checks");
|
||||
tracing::info!("Running checks");
|
||||
if let Err(e) = old_repo.health_check().await {
|
||||
tracing::warn!("Old repo is not configured correctly");
|
||||
return Err(e.into());
|
||||
|
@ -89,8 +89,8 @@ pub(crate) async fn migrate_04<S: Store + 'static>(
|
|||
|
||||
let total_size = old_repo.size().await?;
|
||||
let pct = (total_size / 100).max(1);
|
||||
tracing::warn!("Checks complete, migrating repo");
|
||||
tracing::warn!("{total_size} hashes will be migrated");
|
||||
tracing::info!("Checks complete, migrating repo");
|
||||
tracing::info!("{total_size} hashes will be migrated");
|
||||
|
||||
let mut hash_stream = old_repo.hashes().await.into_streamer();
|
||||
|
||||
|
@ -117,7 +117,7 @@ pub(crate) async fn migrate_04<S: Store + 'static>(
|
|||
if index % pct == 0 {
|
||||
let percent = index / pct;
|
||||
|
||||
tracing::warn!("Migration {percent}% complete - {index}/{total_size}");
|
||||
tracing::info!("Migration {percent}% complete - {index}/{total_size}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ pub(crate) async fn migrate_04<S: Store + 'static>(
|
|||
if index % pct == 0 {
|
||||
let percent = index / pct;
|
||||
|
||||
tracing::warn!("Migration {percent}% complete - {index}/{total_size}");
|
||||
tracing::info!("Migration {percent}% complete - {index}/{total_size}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ pub(crate) async fn migrate_04<S: Store + 'static>(
|
|||
.await?;
|
||||
}
|
||||
|
||||
tracing::warn!("Migration complete");
|
||||
tracing::info!("Migration complete");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue