Skip to content

Commit

Permalink
fix cli script; asyncio.run must be called
Browse files Browse the repository at this point in the history
Resolves this error:

  Sep 06 17:34:19 jhoblitt-test2.dev.lsst.org systemd-s3daemon[696498]: <coroutine object main at 0x7faf99dd1f40>
  Sep 06 17:34:19 jhoblitt-test2.dev.lsst.org systemd-s3daemon[696498]: sys:1: RuntimeWarning: coroutine 'main' was never awaited
  Sep 06 17:34:19 jhoblitt-test2.dev.lsst.org systemd-s3daemon[696498]: RuntimeWarning: Enable tracemalloc to get the object allocation traceback
  • Loading branch information
jhoblitt committed Sep 6, 2024
1 parent 69080f2 commit 11850f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python/s3daemon/s3daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def handle_client(client, reader, writer):
log.info("%f %f sec", start, time.time() - start)


async def main():
async def go():
"""Start the server."""
session = aiobotocore.session.get_session()
async with session.create_client(
Expand All @@ -96,5 +96,10 @@ async def client_cb(reader, writer):
await server.serve_forever()


def main():
"""CLI script entry point."""
asyncio.run(go())


if __name__ == "__main__":
asyncio.run(main())
main()

0 comments on commit 11850f0

Please sign in to comment.