Open w1am opened 2 years ago
I don't think you cannot set a custom pqid when you create your item. Take a look at q.queue() to see how your data is being stored:
[{'id': 1, 'data': {'pqid': 100, 'name': 'william'}, 'timestamp': 1669919848.33653}]
So you are storing a dictionary which contains a pqid entry inside it but the actual id under which your dictionary gets stored under is 1. Thus x = q.get(id={ "pqid": 100, "name": "william" })
will block indefinitely or raise and Empty error as there is no element stored that has an id of { "pqid": 100, "name": "william" }
like you are asking for. On the other hand q.get(id=1)
will work and return {'pqid': 100, 'name': 'william'}
.
After playing around more with this I noticed that even though pqid was set in the put method. it returns the latest sequence number of the sql table i.e
1
instead of100
I tried setting
timeout=0
but it raises Empty error.