Condukt.Sessions.Registry.PG (Condukt v3.0.0)

Copy Markdown View Source

A session registry on :pg, which sees sessions on every connected node.

Each session joins a :pg group named by its id in its own scope, and leaves it when the process exits, so a host whose nodes are connected (for example with libcluster) finds a session by id from any of them.

config :condukt, session_registry: Condukt.Sessions.Registry.PG

Options:

  • :scope - the :pg scope, started by this adapter. Defaults to Condukt.Sessions. Every node of the cluster must use the same one.

:pg is eventually consistent. A session started on another node a moment ago may not be found yet, and two nodes starting a session under the same id at the same moment can both succeed; whereis then prefers the local one. On one node, registrations of an id are serialised, and a session that just exited does not block a new one under its id. Session ids are generated Condukt.SessionIDs unless a caller passes its own, so the second case only arises from callers reusing an id.