-
Notifications
You must be signed in to change notification settings - Fork 34
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
What objects can/should be shared/reused? #166
Comments
Hi @timtucker-dte! So:
Both client and session objects should eventually be closed to free up resources they use. When you do this depends on your use case. Client instance itself doesn't expire, and can be used as long as you need. Sessions (as mentioned) will expire if not used. So if, for example, your code executes some queries frequently it makes sense to keep and re-use session object - it will save some time and network requests. If your script runs, say, every hour, - it's better to create a new session each time and close it when script finishes, so you don't have to deal with expired sessions. Hope this clarifies things a bit, but feel free to ask if any questions |
Thanks! For a session, how would we tell that it's expired? Ideally what we're looking for is the equivalent of what we can get using connection pooling libraries with other SDKs, where most of the object management gets taken care of automatically behind the scenes. |
We cannot until we try to use it. It's a big problem for developers of all connectors, and we don't have anh solution for this so far.
I need to double-check, but if I recall correctly - you'll just get a HTTP 404 when trying to use an expired session
I'm curiour what's a use case for it? |
Reading through and the documentation doesn't seem to be clear on how to handle long running processes that fetch data at intervals over time.
The "hello world" paradigm that we see here:
If we have something like an http trigger in an Azure functions instance, what can be reused:
If resources can be used as singletons, what's the recommended error handling to make sure that they get cleaned up & reinitialized if there's an error?
The only guidance is just
"After you finish working with the operation, session or client, it is better to close it, each of them has a respective method (close())."
The basic question here: at what point do we consider ourselves "finished" working with each object?
The text was updated successfully, but these errors were encountered: