1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

chore: use short handle for process.nextTick

This commit is contained in:
Ruben Bridgewater
2017-05-28 04:32:29 +02:00
parent 0d53d3dcdf
commit b837b46e76
7 changed files with 17 additions and 27 deletions

View File

@@ -127,9 +127,7 @@ describe('connection tests', () => {
client.once('ready', () => {
client.set('foo', 'bar').catch(helper.isError())
client.quit().then(() => done())
process.nextTick(() => {
client._stream.destroy()
})
process.nextTick(() => client._stream.destroy())
})
})
})
@@ -288,9 +286,7 @@ describe('connection tests', () => {
client = redis.createClient({
connectTimeout: 1000
})
process.nextTick(() => {
assert.strictEqual(client._stream._idleTimeout, 1000)
})
process.nextTick(assert.strictEqual, client._stream._idleTimeout, 1000)
client.on('connect', () => {
assert.strictEqual(client._stream._idleTimeout, -1)
assert.strictEqual(client._stream.listeners('timeout').length, 0)

View File

@@ -207,6 +207,6 @@ module.exports = {
family: 4
}
client.address = '127.0.0.1:65535'
client._stream.destroy()
process.nextTick(() => client._stream.destroy())
}
}

View File

@@ -10,11 +10,7 @@ client.set('foo').catch((err) => {
assert(/good-traces.js:9:8/.test(err.stack))
client.set('foo', 'bar').catch((err) => {
assert(/good-traces.js:11:10/.test(err.stack))
client.quit(() => {
process.exit(0)
})
})
process.nextTick(() => {
client._stream.destroy()
client.quit(() => process.exit(0))
})
process.nextTick(() => client._stream.destroy())
})

View File

@@ -476,12 +476,10 @@ describe('The nodeRedis client', () => {
assert(err instanceof redis.InterruptError)
error = err.origin
})
// Make sure we call execute out of the reply
// ready is called in a reply
process.nextTick(() => {
// Fail the set answer. Has no corresponding command obj and will therefore land in the error handler and set
client._replyParser.execute(Buffer.from('a*1\r*1\r$1`zasd\r\na'))
})
// Make sure we call execute out of the reply.
// Ready is called in a reply.
// Fail the set answer. Has no corresponding command obj and will therefore land in the error handler and set
process.nextTick(() => client._replyParser.execute(Buffer.from('a*1\r*1\r$1`zasd\r\na')))
})
})
})