Skip to content

Commit

Permalink
test: fix flaky nsolid-metrics test
Browse files Browse the repository at this point in the history
  • Loading branch information
santigimeno committed Dec 18, 2024
1 parent a4dfbf6 commit 5106e32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/addons/nsolid-metrics/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ static void GetEnvMetricsGone(const FunctionCallbackInfo<Value>& args) {
assert(args[0]->IsNumber());
uint64_t thread_id = args[0].As<Uint32>()->Value();
SharedThreadMetrics tm = ThreadMetrics::Create(GetEnvInst(thread_id));
// The cb should never be called as SharedThreadMetrics is destroyed right
// after leaving the current scope.
// The cb should not be called most of the time as SharedThreadMetrics might
// be destroyed right after leaving the current scope.
args.GetReturnValue().Set(tm->Update(metrics_cb_gone, nullptr, tm.get()));
}

Expand Down
2 changes: 1 addition & 1 deletion test/addons/nsolid-metrics/nsolid-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (!isMainThread) {

process.on('beforeExit', mustCall(() => {
assert.strictEqual(binding.getCbCntr(), wkr_count);
assert.strictEqual(binding.getCbCntrGone(), 0);
assert.ok(binding.getCbCntrGone() < wkr_count/ 2);
assert.strictEqual(binding.getCbCntrLambda(), wkr_count);
}));

Expand Down

0 comments on commit 5106e32

Please sign in to comment.