Skip to content
This repository was archived by the owner on Jan 10, 2019. It is now read-only.
This repository was archived by the owner on Jan 10, 2019. It is now read-only.

Queue has the wrong order #26

@jxson

Description

@jxson

The queue feature in this client breaks the contract:

Normal Priority Put:
// id = generated uuid
MULTI
    LPUSH feed.ids:[feed] [id]
    HSET feed.items:[feed] [id] [item]
    INCR feed.publishes:[feed]
EXEC

High Priority Put:
// id = generated uuid
MULTI
    RPUSH feed.ids:[feed] [id]
    HSET feed.items:[feed] [id] [item]
    INCR feed.publishes:[feed]
EXEC

When executing a normal priority put with queue.put('item', console.log, false) the redis MONITOR reveals:

1355427904.492709 [0 127.0.0.1:53304] "MULTI"
1355427904.492837 [0 127.0.0.1:53304] "rpush" "feed.ids:queue-feed" "cbe2084b-babe-4c9f-93d2-22e14011c6da"
1355427904.495229 [0 127.0.0.1:53304] "hset" "feed.items:queue-feed" "cbe2084b-babe-4c9f-93d2-22e14011c6da" "item"
1355427904.495276 [0 127.0.0.1:53304] "incr" "feed.publishes:queue-feed"
1355427904.495308 [0 127.0.0.1:53304] "EXEC"

It's issuing an RPUSH instead of the contracted LPUSH.

High priority put is also reversed queue.put('high priority item', console.log, true):

1355428543.827813 [0 127.0.0.1:53304] "MULTI"
1355428543.827931 [0 127.0.0.1:53304] "lpush" "feed.ids:queue-feed" "0b273415-4ed7-4452-b030-ca4c8e561122"
1355428543.827982 [0 127.0.0.1:53304] "hset" "feed.items:queue-feed" "0b273415-4ed7-4452-b030-ca4c8e561122" "high priority item"
1355428543.828034 [0 127.0.0.1:53304] "incr" "feed.publishes:queue-feed"
1355428543.828057 [0 127.0.0.1:53304] "EXEC"

This makes popping items in the queue happen in the wrong order, I have a quick fix for this which I will make a pull request for in a few.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions