Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
vote_q proc pickle -> JSON msg migration part 2
Browse files Browse the repository at this point in the history
Part 2 of a multi-phase commit to migrate the message format
of the vote queues from pickle to JSON.

This updates queries.queue_vote() to send the amqp message in
JSON format instead of pickle. It should deployed AFTER part 1
has been deployed to all vote queue processors.
  • Loading branch information
kemitche committed May 5, 2015
1 parent a6b2801 commit ab27bfd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions r2/r2/lib/db/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1715,9 +1715,17 @@ def queue_vote(user, thing, dir, ip, vote_info=None,
user, thing)
return

amqp.add_item(qname,
pickle.dumps((user._id, thing._fullname,
dir, ip, vote_info, cheater)))
vote = {
"uid": user._id,
"tid": thing._fullname,
"dir": dir,
"ip": ip,
"info": vote_info,
"cheater": cheater,
"event": None,
}
amqp.add_item(qname, json.dumps(vote),
headers={"format": "json"})

def prequeued_vote_key(user, item):
return 'registered_vote_%s_%s' % (user._id, item._fullname)
Expand Down

0 comments on commit ab27bfd

Please sign in to comment.