The heap is a list and the behavior for push should keep it sorted. That's
why I said you can just check item 0.
On May 30, 2014 7:11 AM, "Benoit Chesneau" <notifications@github.com> wrote:

In gunicorn/workers/gthread.py:

> +                    except:
> +                        # an exception happened, make sure to close the
> +                        # socket.
> +                        util.close(fs.sock)
> +                    finally:
> +                        # remove the future from our list
> +                        self.futures.remove(fs)
> +
> +
> +            # hanle keepalive timeouts
> +            now = time.time()
> +            while True:
> +                if not len(self._heap):
> +                    break
> +
> +                conn = heapq.heappop(self._heap)

though you need to handle the priority here which was the first reason to
use the heap. Maybe we should just use a list there...

—
Reply to this email directly or view it on GitHub
<https://github.com/benoitc/gunicorn/pull/727/files#r13230154>.