Skip to content

Commit

Permalink
minor udpate to py client
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddlet2666 committed Dec 4, 2024
1 parent c4a27c9 commit 3477ea0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions clients/py/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
from coherence.event import MapListener
from coherence import serialization

import traceback
import sys

def custom_excepthook(exc_type, exc_value, exc_traceback):
print("Unhandled exception occurred:")
traceback.print_exception(exc_type, exc_value, exc_traceback)

sys.excepthook = custom_excepthook

@dataclass
@serialization.proxy("Price")
Expand Down Expand Up @@ -71,11 +79,12 @@ async def run_demo() -> None:
global session

try:
await init_coherence()

if len(sys.argv) < 2:
usage()
return
else:
await init_coherence()
command = sys.argv[1]
symbol: str = ""
count: int = 0
Expand All @@ -95,7 +104,12 @@ async def run_demo() -> None:
await stock_split(symbol, count)

finally:
await session.close()
try:
session
except:
return
else:
await session.close()


async def display_cache_size() -> None:
Expand Down

0 comments on commit 3477ea0

Please sign in to comment.