Skip to content

Conversation

@ownaginatious
Copy link

@ownaginatious ownaginatious commented May 18, 2016

Added a task decorator for qworkerd plugins with most settings already filled out. This is to reduce the amount of boiler plate code required for making a qworkerd plugin.

Syntax of the decorator is like this with default kwargs:

@qworkerd_task(base = QWTask, retry_on = (), no_retry_on = (), fail_handler = None)
def my_task(...):
   ...

To have a task only retry on RequestException and InconsistentException, and send to Sentry on all others, do:

@qworkerd_task(retry_on = (RequestException, InconsistentException))
def my_task(...):
   ...

To have a task retry on all exceptions except RequestException:

@qworkerd_task(no_retry_on = (RequestException,))
def my_task(...):
   ...

If nothing is specified, all exceptions will trigger retries:

@qworkerd_task()
def my_task(...):
   ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant