chore(repo): add debug logging to running tasks service (#31224)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

There are very few logs for the running task service.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

There are logs for the running task service.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jason Jean 2025-05-15 16:57:56 -04:00 committed by GitHub
parent d3ecffedc1
commit 8ff47e0cb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,10 @@ impl RunningTasksService {
let mut results = Vec::<String>::with_capacity(ids.len()); let mut results = Vec::<String>::with_capacity(ids.len());
for id in ids.into_iter() { for id in ids.into_iter() {
if self.is_task_running(&id)? { if self.is_task_running(&id)? {
debug!("Task {} is running", &id);
results.push(id); results.push(id);
} else {
debug!("Task {} is not running", id);
} }
} }
Ok(results) Ok(results)
@ -99,6 +102,7 @@ impl RunningTasksService {
"INSERT OR REPLACE INTO running_tasks (task_id, pid, command, cwd) VALUES (?, ?, ?, ?)", "INSERT OR REPLACE INTO running_tasks (task_id, pid, command, cwd) VALUES (?, ?, ?, ?)",
)?; )?;
stmt.execute([&task_id, &pid.to_string(), &command_str, &cwd])?; stmt.execute([&task_id, &pid.to_string(), &command_str, &cwd])?;
debug!("Added {} to running tasks", &task_id);
self.added_tasks.insert(task_id); self.added_tasks.insert(task_id);
Ok(()) Ok(())
} }
@ -108,7 +112,8 @@ impl RunningTasksService {
let mut stmt = self let mut stmt = self
.db .db
.prepare("DELETE FROM running_tasks WHERE task_id = ?")?; .prepare("DELETE FROM running_tasks WHERE task_id = ?")?;
stmt.execute([task_id])?; stmt.execute([&task_id])?;
debug!("Removed {} from running tasks", task_id);
Ok(()) Ok(())
} }
@ -123,6 +128,7 @@ impl RunningTasksService {
); );
", ",
)?; )?;
debug!("Setup running tasks service");
Ok(()) Ok(())
} }
} }