Hello, I've an http server using the same InteractionContext to handle multiple request creating instances of TxSubmissionClient (without closing any of this clients after response), after several requests I end up with this warning:
(node: 8) MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
11 message listeners added to [WebSocket]. Use emitter.setMaxListeners() to increase limit
@KtorZ already mention the use of submitTx method (without creating any client) and sharing the InteractionContext between requests, but taking a look to the source code of TxSubmissionClient it looks like a wrapper of the underlying websocket with a couple of convenient methods such as: shutdown and internal ensureSocketIsOpen:
/**
* Create a client for submitting signed transactions to underlying Cardano chain.
*
* @category Constructor
**/
export const createTxSubmissionClient = async (
context: InteractionContext
): Promise<TxSubmissionClient> => {
const { socket } = context
return Promise.resolve({
context,
evaluateTx: (bytes) => {
ensureSocketIsOpen(socket)
return evaluateTx(context, bytes)
},
submitTx: (bytes) => {
ensureSocketIsOpen(socket)
return submitTx(context, bytes)
},
shutdown: () => new Promise(resolve => {
ensureSocketIsOpen(socket)
socket.once('close', resolve)
socket.close()
})
} as TxSubmissionClient)
}
So, I'm hitting the limit for a legitimate reason in this case and just need to increase (the default value is 10) the maximum listener value, or there is something else underneath we should care about?
Hello, I've an http server using the same
InteractionContextto handle multiple request creating instances ofTxSubmissionClient(without closing any of this clients after response), after several requests I end up with this warning:@KtorZ already mention the use of
submitTxmethod (without creating any client) and sharing theInteractionContextbetween requests, but taking a look to the source code ofTxSubmissionClientit looks like a wrapper of the underlying websocket with a couple of convenient methods such as:shutdownand internalensureSocketIsOpen:So, I'm hitting the limit for a legitimate reason in this case and just need to increase (the default value is 10) the maximum listener value, or there is something else underneath we should care about?