pino-elasticsearch icon indicating copy to clipboard operation
pino-elasticsearch copied to clipboard

Wouldn't the source code for "Reset Connection Pool in case of destruction" be a problem?

Open orchsik opened this issue 11 months ago • 1 comments

transform.destroy([error])

  • Destroy the stream, and optionally emit an 'error' event. After this call, the transform stream would release any internal resources.
  • Implementors should not override this method, but instead implement readable._destroy().
  • The default implementation of _destroy() for Transform also emit 'close' unless emitClose is set in false.
  • Once destroy() has been called, any further calls will be a no-op and no further errors except from _destroy() may be emitted as 'error'.

[Sources] https://nodejs.org/api/stream.html#transformdestroyerror


"Implementors should not override this method, "

pino-elasticsearch > lib.js

// Resurrect connection pool on destroy
splitter.destroy = () => {
  if (typeof client.connectionPool.resurrect === 'function') {
    client.connectionPool.resurrect({ name: 'elasticsearch-js' })
  }
}

Overriding this method ... Wouldn't the source code for "Reset Connection Pool in case of destruction" be a problem?

orchsik avatar Dec 11 '24 00:12 orchsik