On Wed, Jun 22, 2022 at 05:12:08AM +0000, Hamid Maadani wrote:

> Understood. Is there any prior code in postfix I can repurpose for array 
> management to keep an
> static list of mongoc_client_t objects (one per named dict)? Or should I 
> write it within the module?
> trying to avoid creation and destruction of clients per lookup call, and keep 
> a persistent connection.

You don't need this.  Postfix keepts tables open across queries, reusing
the database connection for multiple queries.  You'll have no static
objects.  All the objects you need should be referenced from the
MongoDB-specific table (dictionary) structure.

Do not confuse "lookup" with "open".  Tables stay open for the lifetime
of the process, but connections can be restarted from time to time,
after some time, or some number of queries, or when they're closed by
the server, and a query detects that the server is gone (in that case
the connection must be reopened and the query transparently retried,
once).

-- 
    Viktor.

Reply via email to