def handle_request(layer_id, redis_conn):
    try:
        # this with-context will attempt to establish a 5 minute lock
        # on the key for this layer, immediately passing on LockTimeout
        # if one isn't availble
        with rlock.Lock(redis_conn,
                        "diff-worker-lock",
                        layer_id,
                        expires=60 * 5):
            # first check if a cached result is already available. The registry
            # already does this, but hey.
            diff_data = layers.get_image_diff_cache(layer_id)
            if not diff_data:
                log.info("Processing diff for %s" % layer_id)
                layers.get_image_diff_json(layer_id)
    except rlock.LockTimeout:
        log.info("Another worker is processing %s. Skipping." % layer_id)
Easy-thumbnails' default name processor.
dataset/ETHPy150Open docker/docker-registry/scripts/diff-worker.py/handle_request--crossover with--dataset/ETHPy150Open SmileyChris/easy-thumbnails/easy_thumbnails/namers.py/default