Compare commits

..

No commits in common. "b0edfb7b01dbf9bdc59c0fb1fda1847f9339ab33" and "cb4dde1dc4bec4b694694693fca01599c34d4d26" have entirely different histories.

1 changed files with 44 additions and 53 deletions

View File

@ -260,67 +260,58 @@ class PublishDispatcher:
False, False,
False, False,
) )
async with self.pool.acquire() as log_connection: async with self.pool.acquire() as connection:
await log_connection.set_type_codec( await connection.set_type_codec(
'json', 'json',
encoder=dumps, encoder=dumps,
decoder=loads, decoder=loads,
schema='pg_catalog' schema='pg_catalog'
) )
async with log_connection.transaction(): risotto_context.connection = connection
risotto_context.log_connection = log_connection for function_obj in self.messages[version][message]['functions']:
async with self.pool.acquire() as connection: function_name = function_obj['function'].__name__
await connection.set_type_codec( info_msg = _(f"call function {function_obj['full_module_name']}.{function_name}")
'json', try:
encoder=dumps, async with connection.transaction():
decoder=loads,
schema='pg_catalog'
)
risotto_context.connection = connection
for function_obj in self.messages[version][message]['functions']:
function_name = function_obj['function'].__name__
info_msg = _(f"call function {function_obj['full_module_name']}.{function_name}")
try: try:
async with connection.transaction(): await log.start(risotto_context,
try: kwargs,
await log.start(risotto_context, info_msg,
kwargs, )
info_msg, await self.check_message_type(risotto_context,
) kwargs,
await self.check_message_type(risotto_context, )
kwargs, await self.launch(risotto_context,
) kwargs,
await self.launch(risotto_context, config_arguments,
kwargs, function_obj,
config_arguments, )
function_obj, # log the success
) await log.success(risotto_context)
# log the success except CallError as err:
await log.success(risotto_context)
except CallError as err:
if get_config()['global']['debug']:
print_exc()
await log.failed(risotto_context,
str(err),
)
except CallError:
pass
except Exception as err:
# if there is a problem with arguments, log and do nothing
if get_config()['global']['debug']: if get_config()['global']['debug']:
print_exc() print_exc()
async with self.pool.acquire() as connection: await log.failed(risotto_context,
await connection.set_type_codec( str(err),
'json', )
encoder=dumps, except CallError:
decoder=loads, pass
schema='pg_catalog' except Exception as err:
) # if there is a problem with arguments, log and do nothing
risotto_context.connection = connection if get_config()['global']['debug']:
async with connection.transaction(): print_exc()
await log.failed(risotto_context, async with self.pool.acquire() as connection:
str(err), await connection.set_type_codec(
) 'json',
encoder=dumps,
decoder=loads,
schema='pg_catalog'
)
risotto_context.connection = connection
async with connection.transaction():
await log.failed(risotto_context,
str(err),
)
class Dispatcher(register.RegisterDispatcher, class Dispatcher(register.RegisterDispatcher,