More logs

This commit is contained in:
Ericson Fogo Soares 2024-01-03 18:43:48 -03:00
parent e1847fcb37
commit f4c35b546e
2 changed files with 30 additions and 0 deletions

View file

@ -452,6 +452,9 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
location_id,
sub_path,
}: LightScanArgs| async move {
tracing::warn!(
"trying to light scan Location: <id='{location_id}', path='{sub_path}'>"
);
if node
.jobs
.has_job_running(|job_identity| {
@ -462,6 +465,7 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
})
.await
{
error!("Still indexing Location, wait a bit...: <id='{location_id}', path='{sub_path}'>");
return Err(rspc::Error::new(
ErrorCode::Conflict,
"We're still indexing this location, pleases wait a bit...".to_string(),
@ -475,6 +479,9 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
.ok_or(LocationError::IdNotFound(location_id))?;
let handle = tokio::spawn(async move {
tracing::warn!(
"spawning light scan Location: <id='{location_id}', path='{sub_path}'>"
);
if let Err(e) = light_scan_location(node, library, location, sub_path).await
{
error!("light scan error: {e:#?}");

View file

@ -524,13 +524,31 @@ pub async fn light_scan_location(
// TODO(N): This isn't gonna work with removable media and this will likely permanently break if the DB is restored from a backup.
if location.instance_id != Some(library.config().await.instance_id) {
warn!(
"Mismatched instance_id, will not light scan location: <id='{}', path='{sub_path}'>",
location.id
);
return Ok(());
}
let location_base_data = location::Data::from(&location);
tracing::warn!(
"shallow indexing Location: <id='{}', path='{sub_path}'>",
location.id
);
indexer::shallow(&location, &sub_path, &node, &library).await?;
tracing::warn!(
"shallow identifying Location: <id='{}', path='{sub_path}'>",
location.id
);
file_identifier::shallow(&location_base_data, &sub_path, &library).await?;
tracing::warn!(
"shallow media processing Location: <id='{}', path='{sub_path}'>",
location.id
);
media_processor::shallow(
&location_base_data,
&sub_path,
@ -541,6 +559,11 @@ pub async fn light_scan_location(
)
.await?;
tracing::warn!(
"light scan complete on Location: <id='{}', path='{sub_path}'>",
location.id
);
Ok(())
}