def handle_request(layer_id, redis_conn):
 try:
  with rlock.Lock(redis_conn, 'diff-worker-lock', layer_id, expires=(60 * 5)):
   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))

def handle_request ( layer_id , redis_conn ) : try : with rlock . Lock ( redis_conn , 'diff-worker-lock' , layer_id , expires = ( 60 * 5 ) ) : 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 ) )
used as the io handler for subsequent requests .