bugfix
This commit is contained in:
parent
feb966cba4
commit
953a10ac58
@ -31,29 +31,29 @@ from llmage.accounting import (
|
||||
)
|
||||
|
||||
def main():
|
||||
logger = MyLogger('backend_accounting', levelname='info',
|
||||
logfile=os.path.join(os.getcwd(), 'logs', 'backend_accounting.log'))
|
||||
info(f'Backend accounting process started (PID: {os.getpid()})')
|
||||
logger = MyLogger('backend_accounting', levelname='info',
|
||||
logfile=os.path.join(os.getcwd(), 'logs', 'backend_accounting.log'))
|
||||
info(f'Backend accounting process started (PID: {os.getpid()})')
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
|
||||
def handle_signal(signum, frame):
|
||||
info(f'Received signal {signum}, shutting down...')
|
||||
for task in asyncio.all_tasks(loop):
|
||||
task.cancel()
|
||||
loop.stop()
|
||||
def handle_signal(signum, frame):
|
||||
info(f'Received signal {signum}, shutting down...')
|
||||
for task in asyncio.all_tasks(loop):
|
||||
task.cancel()
|
||||
loop.stop()
|
||||
|
||||
signal.signal(signal.SIGTERM, handle_signal)
|
||||
signal.signal(signal.SIGINT, handle_signal)
|
||||
signal.signal(signal.SIGTERM, handle_signal)
|
||||
signal.signal(signal.SIGINT, handle_signal)
|
||||
load_accounting()
|
||||
try:
|
||||
loop.run_until_complete(backend_accounting())
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
finally:
|
||||
loop.close()
|
||||
info('Backend accounting process stopped.')
|
||||
try:
|
||||
loop.run_until_complete(backend_accounting())
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
finally:
|
||||
loop.close()
|
||||
info('Backend accounting process stopped.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user