Skip to content

Instantly share code, notes, and snippets.

@oak-tree
Created November 14, 2017 14:20
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 oak-tree/b4cfa322fdbafe33aedb2b8dd6acd074 to your computer and use it in GitHub Desktop.
Save oak-tree/b4cfa322fdbafe33aedb2b8dd6acd074 to your computer and use it in GitHub Desktop.
azure mssage lock
msg_locked_until = dateutil.parser.parse(msg.broker_properties['LockedUntilUtc'])
if (datetime.now(utc) + timedelta(0, lock_buff_seconds)) > msg_locked_until:
logger.info("Renewing message lock")
try:
msg.renew_lock()
logger.info("Done.")
except Exception as e:
logger.error("Failed renewing the message lock.")
logger.error(e.message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment