Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add client.terminate() #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abdullahshahin
Copy link

enable the client to close the web socket once they're need it, this method will make sure all commands have been done executing and then it will close the socket

let gremlin = require('gremlin-secure');
const client = gremlin.createClient(
        443,
        "someURL.graphs.azure.com",
        {
            session: false,
            ssl: true,
            user: "/dbs/test/colls/test",
            password: "secretPassword"
        }
        );
for(var i =0; i < 30; i++){
      client.execute('g.V().has("id", id)', { id: 'shahin' }, (err, results) => {
          if (err) {
              return console.error(err)
          }
          console.log(results);
      });
}
client.terminate();

@jbmusso
Copy link
Owner

jbmusso commented Aug 7, 2017

I don't think setInterval is the right thing to do here. Could you please share what you had in mind?

@abdullahshahin
Copy link
Author

make sure all commands have been executed, once terminate is submitted, there is a chance to have some commands are still being processed and the response is not delivered yet, so am setting the interval to keep checking whether its a good time to end the web socket, I have a use case to insert thousands of entries using async.eachLimit and every time I got 50 transitions, the 50 transactions may not delivered in time.
I may realize that this could occupy a cpu power, is there any better way we can handle it differently ?

@brianfoody
Copy link

I think my pull request covers this?

#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants