Skip to content

Commit

Permalink
Bump version to 0.1.7
Browse files Browse the repository at this point in the history
* improved asyncio shutdown for examples
  • Loading branch information
robertbetts committed Sep 28, 2023
1 parent 8247b70 commit 2db5d92
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def main():
total_sample_count = 0
total_request_time = 0

batch_size = 500
batch_size = 5000
number_of_batches = 5
ioloop = asyncio.get_event_loop()

Expand Down
14 changes: 10 additions & 4 deletions examples/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ async def main():
try:
logging.info("Service %s ready", service_example._service_name)
await asyncio.Event().wait()
except KeyboardInterrupt:
logging.info("Shutting down signal received")

logging.info("Service %s done", service_example._service_name)
await container.stop()
except BaseException as err:
logging.info("Shutting down. %s: %s", type(err).__name__, err)
await container.stop()
finally:
logging.info("Service %s done", service_example._service_name)


if __name__ == "__main__":
Expand All @@ -99,4 +102,7 @@ async def main():
logging.getLogger("pika").setLevel(logging.CRITICAL)
logging.getLogger("etcd3").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
asyncio.run(main())
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
13 changes: 10 additions & 3 deletions examples/server_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ async def main():
transport_settings=transport_settings,
)
await mesh_api.connect()

try:
logging.info("Service %s ready", service_instance._service_name)
await asyncio.Event().wait()
except KeyboardInterrupt:
logging.info("Shutting down signal received")
await mesh_api.disconnect()
except BaseException as err:
logging.info("Shutting down. %s: %s", type(err).__name__, err)
await mesh_api.disconnect()
finally:
logging.info("Service %s done", service_instance._service_name)

logging.info("Service %s done", service_instance._service_name)

Expand All @@ -61,4 +65,7 @@ async def main():
logging.getLogger("pika").setLevel(logging.WARNING)
logging.getLogger("etcd3").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
asyncio.run(main())
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nuropb"
version = "0.1.6"
version = "0.1.7"
description = "NuroPb - A Distributed Event Driven Service Mesh"
authors = ["Robert Betts <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/nuropb/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

logger = logging.getLogger(__name__)

NUROPB_VERSION = "0.1.6"
NUROPB_VERSION = "0.1.7"
NUROPB_PROTOCOL_VERSION = "0.1.1"
NUROPB_PROTOCOL_VERSIONS_SUPPORTED = ("0.1.1",)
NUROPB_MESSAGE_TYPES = (
Expand Down

0 comments on commit 2db5d92

Please sign in to comment.