独角兽 - Python 偶尔返回难以解释的结果

2024-09-28 21:32:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个使用Gunicorn的非常初级的web服务器。回调函数是一个本机python函数。下面是回调函数中app函数的一个片段。重新启动gunicorn父进程后,有时会使用VOCFE_STATUS_NO_模式调用raise_error函数,而不会打印其上方的日志行。这种情况发生在重新启动之前已经工作的请求上,并且发生在生成的所有8个子gunicorn进程上。杀死一个gunicorn子进程可以纠正被杀死的子进程中的问题,请求处理也可以

如果重新启动后第一个请求没有出现问题,则永远不会发生

同事们和我一样都是理论之外的人,所以任何有效的理论都会对我有所帮助

if path not in SCHEMA_IGNORANT_PATHS:

         if 'serverState' in body and 'schemaName' in body['serverState']:
             schema = body['serverState']['schemaName']
         elif len (path_bits) > 1:
             schema = path_bits[1]
         else:
             schemas = be_db.select('public.tenant', {}, ['schema_name'])
             if not schemas or len(schemas) == 0:
                 LOG.info("No schema in the tenant table")
                 return raise_error (response_callback, VOCFE_STATUS_NO_SCHEMA)
             if len(schemas) > 1:
                 LOG.info("No client signaled schema, but {} schemas available".format(len(schemas)))
                 return raise_error (response_callback, VOCFE_STATUS_INVALID_SCHEMA)

             schema = schemas[0]['schema_name']

Tags: path函数inlenif进程schemastatus