Skip to content

Instantly share code, notes, and snippets.

@lolobosse
Created May 3, 2019 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lolobosse/2060032aa66be03c1ac42772a993640b to your computer and use it in GitHub Desktop.
Save lolobosse/2060032aa66be03c1ac42772a993640b to your computer and use it in GitHub Desktop.
t = Task(type='resize', arguments=json.dumps({'new_width': width, 'url': url, 'bucket': self.bucket}))
try:
db.session.add(t)
db.session.commit()
sys_log.info("Added the resize task to the DB")
except IntegrityError as integrityerror:
db.session.rollback()
sys_log.info("Task is conflicting with another task in the DB")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment