Skip to content

Commit

Permalink
async_hooks: don't set hook_fields[kTotals] to 0
Browse files Browse the repository at this point in the history
This commit removes the setting of hook_field[kTotals] to szero in
AsyncHook's enable function.

As far as I can tell this would not be required if the setting of
this field is done with the assignment operator instead of using the
addition assignment operator.
  • Loading branch information
danbev committed Mar 8, 2018
1 parent 4d07434 commit 07cd9c6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ class AsyncHook {
return this;

const prev_kTotals = hook_fields[kTotals];
hook_fields[kTotals] = 0;

// createHook() has already enforced that the callbacks are all functions,
// so here simply increment the count of whether each callbacks exists or
// not.
hook_fields[kTotals] += hook_fields[kInit] += +!!this[init_symbol];
hook_fields[kTotals] = hook_fields[kInit] += +!!this[init_symbol];
hook_fields[kTotals] += hook_fields[kBefore] += +!!this[before_symbol];
hook_fields[kTotals] += hook_fields[kAfter] += +!!this[after_symbol];
hook_fields[kTotals] += hook_fields[kDestroy] += +!!this[destroy_symbol];
Expand Down

0 comments on commit 07cd9c6

Please sign in to comment.