INSERT_INTO_HOMEFEED_BATCH = 10000

@shared_task
def insert_into_homefeed(photo_id, user_id, index=0):
    r_server = redis.Redis(connection_pool=pool)
Django, Celery, Redis, RabbitMQ: Chained Tasks for Fanout-On-Writes