-
Notifications
You must be signed in to change notification settings - Fork 448
connection router to accomodate multithreading #727
Conversation
connection router hook added to accommodate multithreaded servers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test and update docs?
Sure, I think I have a handle on your test system. |
it seems like multi threading with the It seems like it might be easier to start the server and send connection to worker threads without ldapjs. const net = require("net");
net.createServer(connectionRouter) What are the benefits of using ldapjs to start the server when you are using |
My aim was to make things minimally-invasive from an API standpoint. The The |
This is a mess in trying to get around the tap test framework's thread handling, here's what I have thus far though - might need to take a break from it today but the code paths are being hit (failing test with "test unfinished" and I haven't pinned down why as of yet (I placed this in
|
I would agree that if the |
removal of hook while keeping `newConnection` change from private to public for use in multithreaded applications
I think it would be easiest to mock the threads instead of trying to run the tests in actual threads. Just testing that |
Would you like it with or without |
Maybe two tests, one each way? |
tests for multithreading support via non-ldapjs-server and via hook into ldapjs server
adding connectionRouter hook back in
Tests added and connectionRouter hook added back in. |
net dependency
linting typos fixed
@UziTech updated to fix linting issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you able to add some documentation? An example in the docs would be quite helpful.
working example of cluster-based multithreading utilizing connectionRouter override.
Addition of working example demonstrating threading via clustering and a net server forwarding socket connections to ldapjs.
Updated examples documentation.
Added examples in the examples directory for both multithreading via the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me once CI is green.
@CoryGH you can run |
Please include a minimal reproducible example |
connection router hook added to accommodate multithreaded servers
e.g. passing
options.connectionRouter(connection)
will allow for:in order to preserve extant functionality while adding multi-threading support.