geldata / geldata/gel-python

Make `create_client()` return a singleton client

Aperta
#628 1 commento 0 reazioni 1 assegnatario Rivendicata da @1st1 Vedi su GitHub
high priority
Lingua principale
Python
Stelle
415
Fork
50
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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]`

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.