Skip to content

refactor(scanner): remove non longer necessary timers.setImediate() #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/fast-eagles-go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@nodesecure/scanner": minor
---
refactor(scanner): remove useless try finally surrounding extractAndResolve in verify
4 changes: 0 additions & 4 deletions workspaces/scanner/src/depWalker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Import Node.js Dependencies
import path from "node:path";
import { readFileSync } from "node:fs";
import timers from "node:timers/promises";

// Import Third-party Dependencies
import { Mutex, MutexRelease } from "@openally/mutex";
Expand Down Expand Up @@ -192,7 +191,6 @@ export async function depWalker(

logger.end(ScannerLoggerEvents.analysis.tree);
await Promise.allSettled(operationsQueue);
await timers.setImmediate();

logger
.end(ScannerLoggerEvents.analysis.tarball)
Expand Down Expand Up @@ -283,8 +281,6 @@ export async function depWalker(
return payload as Payload;
}
finally {
await timers.setImmediate();

logger.emit(ScannerLoggerEvents.done);
}
}
Expand Down
19 changes: 7 additions & 12 deletions workspaces/scanner/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Import Node.js Dependencies
import path from "node:path";
import fs from "node:fs/promises";
import timers from "node:timers/promises";
import os from "node:os";

// Import Third-party Dependencies
Expand Down Expand Up @@ -90,18 +89,14 @@ export async function verify(

await using tempDir = await TempDirectory.create();

try {
const mama = await tarball.extractAndResolve(tempDir.location, {
spec: packageName,
registry: getLocalRegistryURL()
});
const scanResult = await tarball.scanPackage(mama);
const mama = await tarball.extractAndResolve(tempDir.location, {
spec: packageName,
registry: getLocalRegistryURL()
});

return scanResult;
}
finally {
await timers.setImmediate();
}
const scanResult = await tarball.scanPackage(mama);

return scanResult;
}

export {
Expand Down