def METHOD_NAME(rule):
    if not rule.active:
        return
    rule.locked_for_editing = True
    rule.save(update_fields=['locked_for_editing'])
    transaction.on_commit(lambda: run_messaging_rule.delay(rule.domain, rule.pk))