geldata / geldata/gel-python

Make `create_client()` return a singleton client

Open
#628 1 comment 0 reactions 1 assignee Claimed by @1st1 View on GitHub
high priority
Dominant language
Python
Stars
415
Forks
50
PR merge metrics
No merged PRs in 30d

Description

We've discussed this multiple times, time to do it.

`create_client()` and `create_async_client()` should create a client once upon the first call (one sync singleton and one async singleton respectively) and follow on calls should just return that first thing.

* Add `detached=False` argument to force creating a new client when flipped to `True`
* Obviously singletons should be partitioned by connection arguments
* Use `weakref.WeakValueDictionaty[ConnectionSpec, Client]`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.