Updated closing logic

This commit is contained in:
delvedor
2018-12-19 19:49:29 +01:00
parent 7a181ff9ac
commit fc6d12ad3e
3 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,7 @@
'use strict'
const { EventEmitter } = require('events')
const debug = require('debug')('elasticsearch')
const Transport = require('./lib/Transport')
const Connection = require('./lib/Connection')
const ConnectionPool = require('./lib/ConnectionPool')
@ -92,8 +93,8 @@ class Client extends EventEmitter {
this.close(resolve)
})
}
this.connectionPool.empty()
callback()
debug('Closing the client')
this.connectionPool.empty(callback)
}
}