Skip to content

returning worker to pool too early? #1

Description

@lefant

Hi,

I was just reading through your code (planning to use poolboy for a connection pool myself), when I noticed something weird in eredis_pool:q/3:

q(PoolName, Command, Timeout) ->
Worker = poolboy:checkout(PoolName),
poolboy:checkin(PoolName, Worker),
Reply = eredis:q(Worker, Command, Timeout),
Reply.

shouldn't the poolboy:checkin.. really happen after the Worker has done its eredis:q... request? like so:

q(PoolName, Command, Timeout) ->
Worker = poolboy:checkout(PoolName),
Reply = eredis:q(Worker, Command, Timeout),
poolboy:checkin(PoolName, Worker),
Reply.

otherwise the worker immediately becomes available to other concurrent clients, even before it is done with the request, no?

I am not really planning to use redis at the moment, so ignore / delete at your leisure, but since I already spotted it, I figured I may as well drop you a note.

Fabian

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions