Skip to content

What objects can/should be shared/reused? #166

Open
@timtucker-dte

Description

@timtucker-dte

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:

  1. Get a client
  2. Get a session from the client
  3. Perform an operation on the session
  4. Close the operation
  5. Close the session
  6. Close the client

If we have something like an http trigger in an Azure functions instance, what can be reused:

  • Can we share a client as a singleton, or do we need a new one for each http request that comes in and executes a query?
  • Can we share a session as a singleton, or do we need a new one for each http request that comes in and executes a query?

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions