Skip to content

Commit

Permalink
refactor: prefix unused params with underscores (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Dec 30, 2024
1 parent 107d415 commit 9fb4553
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ async function fastifyUnderPressure (fastify, opts = {}) {
return okResponse
}

function onClose (fastify, done) {
function onClose (_fastify, done) {
clearTimeout(timer)
clearTimeout(externalHealthCheckTimer)
done()
Expand Down
26 changes: 13 additions & 13 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('Should return 503 on maxEventLoopDelay', t => {
maxEventLoopDelay: 15
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -58,7 +58,7 @@ test('Should return 503 on maxEventloopUtilization', { skip: !isSupportedVersion
maxEventLoopUtilization: 0.60
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -92,7 +92,7 @@ test('Should return 503 on maxHeapUsedBytes', t => {
maxHeapUsedBytes: 1
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -126,7 +126,7 @@ test('Should return 503 on maxRssBytes', t => {
maxRssBytes: 1
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -162,7 +162,7 @@ test('Custom message and retry after header', t => {
retryAfter: 50
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -205,11 +205,11 @@ test('Custom error instance', t => {
customError: CustomError
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

fastify.setErrorHandler((err, req, reply) => {
fastify.setErrorHandler((err, _req, reply) => {
t.ok(err instanceof Error)
return reply.code(err.statusCode).send(err)
})
Expand Down Expand Up @@ -243,15 +243,15 @@ test('memoryUsage name space', t => {
maxHeapUsedBytes: 100000000,
maxRssBytes: 100000000,
maxEventLoopUtilization: 0.85,
pressureHandler: (req, rep, type, value) => {
pressureHandler: (_req, _rep, _type, _value) => {
t.ok(fastify.memoryUsage().eventLoopDelay > 0)
t.ok(fastify.memoryUsage().heapUsed > 0)
t.ok(fastify.memoryUsage().rssBytes > 0)
t.ok(fastify.memoryUsage().eventLoopUtilized >= 0)
}
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -283,7 +283,7 @@ test('memoryUsage name space (without check)', t => {
const fastify = Fastify()
fastify.register(underPressure)

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
t.ok(fastify.memoryUsage().eventLoopDelay > 0)
t.ok(fastify.memoryUsage().heapUsed > 0)
t.ok(fastify.memoryUsage().rssBytes > 0)
Expand Down Expand Up @@ -327,7 +327,7 @@ test('Custom health check', t => {
healthCheckInterval: 1000
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -360,7 +360,7 @@ test('Custom health check', t => {
healthCheckInterval: 1000
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down Expand Up @@ -390,7 +390,7 @@ test('Custom health check', t => {
healthCheckInterval: 100
})

fastify.get('/', (req, reply) => {
fastify.get('/', (_req, reply) => {
reply.send({ hello: 'world' })
})

Expand Down
2 changes: 1 addition & 1 deletion test/issues/216.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test('should be unhealthy if healthCheck throws an error', async t => {
healthCheck: async () => { throw new Error('Kaboom!') },
healthCheckInterval: 1000,
exposeStatusRoute: true,
pressureHandler: (req, rep, type) => {
pressureHandler: (_req, rep, type) => {
t.equal(type, underPressure.TYPE_HEALTH_CHECK)
rep.status(503).send('unhealthy')
}
Expand Down
Loading

0 comments on commit 9fb4553

Please sign in to comment.