Optimize "auto-receive" batch process

disable versioning when doing "auto-receive" for a receiving batch
This commit is contained in:
Lance Edgar 2023-07-06 21:23:44 -05:00
parent 8742a03e18
commit 58f9b3ce2a
2 changed files with 29 additions and 64 deletions

View file

@ -931,7 +931,7 @@ class BatchMasterView(MasterView):
prefix = self.rattail_config.get('rattail', 'command_prefix',
default=sys.prefix)
cmd = [os.path.join(prefix, 'bin/{}'.format(command))]
for path in self.rattail_config.files_read:
for path in reversed(self.rattail_config.files_read):
cmd.extend(['--config', path])
if username:
cmd.extend(['--runas', username])
@ -969,6 +969,10 @@ class BatchMasterView(MasterView):
batch_uuid = key[0]
# figure out the (sub)command args we'll be passing
if handler_action == 'auto_receive':
subcommand = 'auto-receive'
else:
subcommand = f'{handler_action}-batch'
subargs = [
'--batch-type',
self.handler.batch_key,
@ -987,7 +991,7 @@ class BatchMasterView(MasterView):
command_args=[
'--no-versioning',
],
subcommand='{}-batch'.format(handler_action),
subcommand=subcommand,
subcommand_args=subargs)
except Exception as error:
log.warning("%s of '%s' batch failed: %s", handler_action, self.handler.batch_key, batch_uuid, exc_info=True)