amenezes / config-client

config-client package for spring cloud config and cloud foundry
https://config-client.amenezes.net/
Apache License 2.0
24 stars 18 forks source link

Client not actually async #43

Closed joshuahaertel closed 3 years ago

joshuahaertel commented 3 years ago

I suggest removing references about asyncio until the client is actually asyncio compliant.

If it were asyncio compliant, the example code would include the await keyword, like so:

async def start(config_client):
    await config_client.get_config()
    print(config_client.config)

await start(config_client)

The clarification is important, as applications which regularly call get_config, expecting it to be async, will block their event loop while the request occurs. Calling get_config once on application startup is fine for async applications, as is done in the aiohttp extension, because the actual async part of the application isn't running yet. However, the fact that the application is async is irrelevant in that case.

amenezes commented 3 years ago

@joshuahaertel thanks for your question.

I'll try fix this in the next release.

amenezes commented 3 years ago

@joshuahaertel,

The project documentation was updated to exemplifying a little better the use of lib with asyncio.

Thank you for your comment and in case there is any doubt reopen this issue.