Skip to content

Queue.dequeue_any breaks with a promise #10

@puttu

Description

@puttu

When testing pq out I've managed to break it by adding a job scheduled for the future and right next enqueuing an immediate one. This resulted in this partial stack:

  File "/Users/m/Dropbox/projects/tlink/pq/worker.py", line 313, in work
    result = self.dequeue_job_and_maintain_ttl(timeout)
  File "/Users/m/Dropbox/projects/tlink/pq/worker.py", line 352, in dequeue_job_and_maintain_ttl
    return PQ.dequeue_any(self.queues, timeout)
  File "/Users/m/Dropbox/projects/tlink/pq/queue.py", line 360, in dequeue_any
    if q.serial and not q.acquire_lock(timeout):
AttributeError: 'unicode' object has no attribute 'serial'

It seems to be caused by the fact that Job._get_job_or_promise returns job.queue_id as the promise, while Queue.dequeue_any expects a Queue object when it adds it to stack (queue_stack.append(promise)).

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