Fixes from testing
This commit is contained in:
@@ -153,12 +153,14 @@ async def call_cleverthis_api(
|
||||
f" [*] INVOKE ENDPOINT: {api_method.__name__}, ARGS: {', '.join(f'{k}={v}' for k, v in _verified_args.items())}")
|
||||
_result: Any = await api_method(**_verified_args)
|
||||
logging.info(f" [*] ENDPOINT RESULT: {api_method.__name__}, RESULT: {str(_result)}")
|
||||
_json_result, _content_type = await convert_file_response(_result, message.channel), 'application/octet-stream' \
|
||||
if isinstance(_result, FileResponse) else _result, 'application/json'
|
||||
_binary_result = _json_result.encode('utf-8') if hasattr(_json_result, 'encode') else \
|
||||
_json_result.body if hasattr(_json_result, 'body') else \
|
||||
_json_result.read() if hasattr(_json_result, 'read') else \
|
||||
_json_result
|
||||
_json_result, _content_type = await convert_file_response(
|
||||
_result, message.channel
|
||||
), 'application/octet-stream' if isinstance(_result, FileResponse) else _result, 'application/json'
|
||||
_binary_result = _json_result.encode('utf-8') if hasattr(
|
||||
_json_result, 'encode'
|
||||
) else _json_result.body if hasattr(
|
||||
_json_result, 'body'
|
||||
) else _json_result.read() if hasattr(_json_result, 'read') else _json_result
|
||||
return DataResponseFactory.of(message.id, success_code, _content_type, _binary_result, message.trace_info)
|
||||
except HTTPException as http_error:
|
||||
_tb = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
|
||||
@@ -178,8 +178,10 @@ class DataMessageHandler:
|
||||
last_data_message_time = time.time()
|
||||
|
||||
# Call the async on_message method. This shall also ACK the message after processing.
|
||||
a_message = AMQMessage(amq_message, self.rabbit_mq_client.channel)
|
||||
print(f" [*] ######[{message.delivery_tag}] about to call asyncio.run(on_message) with AMQ Message: {a_message}")
|
||||
response: DataResponse = asyncio.run(
|
||||
self.service_adapter.on_message(AMQMessage(amq_message, self.rabbit_mq_client.channel))
|
||||
self.service_adapter.on_message(a_message)
|
||||
)
|
||||
try:
|
||||
logging.info(" [*] ######[%s] AMQ Message Reply.1, To=%s, msgId=%s",
|
||||
|
||||
Reference in New Issue
Block a user