Skip to content

Commit

Permalink
try this way to ensure msg are always sent
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jul 21, 2023
1 parent 1614567 commit 5b620ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pioreactor/cli/pio.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ def log(message: str, level: str, name: str, local_only: bool):
to_mqtt=not local_only,
)
getattr(logger, level)(message)
sleep(0.5) # wait to make sure msg gets to mqtt

# flush and close handlers
for handler in logger.handlers:
handler.flush()
handler.close()

except Exception:
# don't let a logging error bring down a script...
pass
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click==8.1.3
click==8.1.6
paho-mqtt==1.6.1
psutil==5.9.5
sh==1.14.2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


CORE_REQUIREMENTS = [
"click==8.1.3",
"click==8.1.6",
"paho-mqtt==1.6.1",
"psutil==5.9.5",
"sh==1.14.3",
Expand Down

0 comments on commit 5b620ee

Please sign in to comment.