Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified connection-flask.py so that each print statement gets flushe… #11

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/connection-service/connection-flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
from collections import namedtuple
from flask import Flask, request, abort, make_response

# 30-Jan-2025, KAB: tweak the print() statement default behavior so that it always flushes the output.
# Without this, debug messages from this code appear in the ConnSvc log file at somewhat random times.
import functools
print = functools.partial(print, flush=True)

partitions={}
partlock=Lock()
Expand Down Expand Up @@ -153,6 +157,9 @@ def publish():
#print (f"{connection=}")
if 'uid' in connection and 'uri' in connection:
uid=connection['uid']
if debug_level>1:
now=datetime.now()
print(f"[{now}] Publish uid={uid}")
store[uid]=Connection(uri=connection['uri'],
connection_type=connection['connection_type'],
data_type=connection['data_type'],
Expand Down