server.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:katana-sdk-python2 作者: kusanagi 项目源码 文件源码
def __process_request(self, stream, pid, timeout):
        # Process request and get response stream.
        # Request are processed inside a thread pool to avoid
        # userland code to block requests.
        res = self._pool.spawn(self.__process_request_stream, stream)

        # Wait for a period of seconds to get the execution result
        try:
            response = res.get(timeout=timeout)
        except gevent.Timeout:
            msg = 'SDK execution timed out after {}ms'.format(
                int(timeout * 1000),
                pid,
                )
            response = create_error_response(msg)
            LOG.warn('{}. PID: {}'.format(msg, pid))
        except:
            LOG.exception('Failed to handle request. PID: %d', pid)
            response = create_error_response('Failed to handle request')

        self._send_response(response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号