Skip to content

Commit

Permalink
chore: much nicer sequencing suggestion from Alan to avoid a race
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm committed Dec 7, 2020
1 parent c324167 commit 62c81a7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/central-config-enabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,15 @@ test('agent.logger updates for central config `log_level` change', { timeout: 10
})
res.end(JSON.stringify({ log_level: 'error' }))

const SHORT_TIME_LATER = 10 // Hopefully this isn't a race we lose.
setTimeout(function () {
agent._transport.once('config', function () {
// 4. agent.logger should be updated from central config.
t.equal(agent.logger.level, 'error',
'shortly after fetching central config, agent.logger level should be updated')

agent.destroy()
server.close()
t.end()
}, SHORT_TIME_LATER)
})
})

// 1. Start a mock APM Server.
Expand Down

0 comments on commit 62c81a7

Please sign in to comment.