Skip to content

Instantly share code, notes, and snippets.

@kennethreitz
Created March 5, 2012 20:51
Show Gist options
  • Select an option

  • Save kennethreitz/1980996 to your computer and use it in GitHub Desktop.

Select an option

Save kennethreitz/1980996 to your computer and use it in GitHub Desktop.

Revisions

  1. Kenneth Reitz revised this gist Mar 5, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions per-user-throttle.py
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ def send_shit(article):
    def user_send(user, article):
    taskname = "send.{user}".format(user.name)

    t = task(name=taskname)(send_shit, article)
    t = task(name=taskname)(send_shit)
    rate_limit(taskname, "1/s")

    return t
    return t(article)
  2. Kenneth Reitz revised this gist Mar 5, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion per-user-throttle.py
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ def send_shit(article):
    def user_send(user, article):
    taskname = "send.{user}".format(user.name)

    t = task(name=taskname)(send_shit(article))
    t = task(name=taskname)(send_shit, article)
    rate_limit(taskname, "1/s")

    return t
  3. Kenneth Reitz revised this gist Mar 5, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions per-user-throttle.py
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    from celery.task.control import task, rate_limit


    def send_shit(article):
    ...
  4. Kenneth Reitz created this gist Mar 5, 2012.
    12 changes: 12 additions & 0 deletions per-user-throttle.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@

    def send_shit(article):
    ...


    def user_send(user, article):
    taskname = "send.{user}".format(user.name)

    t = task(name=taskname)(send_shit(article))
    rate_limit(taskname, "1/s")

    return t