Skip to content

Instantly share code, notes, and snippets.

View kbhalerao's full-sized avatar

Kaustubh Bhalerao kbhalerao

View GitHub Profile
@kbhalerao
kbhalerao / consumer decorators.py
Created April 23, 2025 14:29
Some decorators to make Channels Background Worker consumers a bit more resilient to failure
import asyncio
import inspect
import logging
import time
import traceback
from functools import wraps
from typing import Callable, Any
from channels.layers import get_channel_layer
from django.utils.timezone import now
from django.conf import settings