Skip to content

Inconsistent type hint in async client definition #586

@joe-clickhouse

Description

@joe-clickhouse

In async def create_async_client (here) we allow executor_threads to be optional. However, the AsyncCleint class definition here we force it to be an int. If the user does not supply executor_threads in get_async_client, default of None is passed to AsyncCleint.__init__ which it accepts. if executor_threads == 0: fails because it's None, and we end up doing self.executor = ThreadPoolExecutor(max_workers=None). It just so happens that the behavior of creating a ThreadPoolExecutor instance when max_workers is None is the same as what we do with a value of 0: executor_threads = min(32, (os.cpu_count() or 1) + 4) so we're seeing consistent behavior on accident. We just need to fix the type hint and default behavior in get_async_client for executor_threads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions