Skip to content

Commit

Permalink
[system-utility] NamespaceNotFound is thrown when profiler gets run f…
Browse files Browse the repository at this point in the history
…or the first time
  • Loading branch information
Cihad Tekin committed Dec 27, 2024
1 parent c86288e commit b6c1a98
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions plugins/system-utility/api/system.utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,23 @@ async function stopProfiler(processName) {
const errors = [];

// clear old files
await new Promise(
(res, rej) => countlyFs.gridfs.deleteAll(
PROFILER_DIR,
null,
err => err ? rej(err) : res()
)
);
try {
await new Promise(
(res, rej) => countlyFs.gridfs.deleteAll(
PROFILER_DIR,
null,
err => err ? rej(err) : res()
)
);
}
catch (err) {
if (err.code === 26) { // NamespaceNotFound: thrown when there's no collection initially
// do nothing...
}
else {
throw err;
}
}

// coverage
try {
Expand Down

0 comments on commit b6c1a98

Please sign in to comment.