Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make link submission more robust.

  • Loading branch information...
commit fddda124402c705f668e7410738224c0f83b3d49 1 parent 0f838bd
Neil Williams authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 scripts/submit_link.py
7 scripts/submit_link.py
View
@@ -5,8 +5,10 @@
from r2.models import Account, Subreddit, Link
from r2.lib.db import queries
from r2.lib.media import force_thumbnail
+from r2.lib.amqp import worker
+UPVOTE = True
def submit_link(user, subreddit, title, url, thumb_url):
account = Account._by_name(user)
subreddit = Subreddit._by_name(subreddit)
@@ -20,8 +22,11 @@ def submit_link(user, subreddit, title, url, thumb_url):
force_thumbnail(link, image_data)
# various backend processing things
- queries.queue_vote(account, link, True, ip)
+ queries.queue_vote(account, link, UPVOTE, ip)
queries.new_link(link)
queries.changed(link)
+ # wait for the amqp worker to finish up
+ worker.join()
+
print link.make_permalink_slow()
Please sign in to comment.
Something went wrong with that request. Please try again.