Open dmitryashutov opened 1 year ago
Also we need to keep in mind this https://docs.aiohttp.org/en/stable/client_advanced.html#graceful-shutdown
Hello, We are using your library at our company, and we really like it. I' am interested in contributing for this issue. Are you open for it ? ClientSession object should be owned by the fhirClient (if so, client should receive args/kwargs to customize its creation) ? Or should it be created outside of the lib ? What do you think ?
In the
AsyncClient._do_request
we create theaiohttp.ClientSession
instance for every single request ( https://github.com/beda-software/fhir-py/blob/e8410653689700fcd16cbd24edb0c64d63379af8/fhirpy/base/lib.py#L124)Maybe it's not a big problem but the aiohttp documentation says:
It makes sense to follow the recommendation above and provide the API for closing the session during the application cleanup.