I have a Python script I run from a Docker container and I have it print out what it's doing so that I can view that in docker logs -f <container>
. The logs do print...but they seem to print in "batches" as opposed to real-time. They used to show up in real-time and I don't know what has changed.
The relevant part of the script:
point = f"temp value={temp}"
topic = f"lp/things/{client_name}/temp"
print(f"Publishing to topic: {topic}\n\tPayload: {point}")
(rc, mid) = client.publish(topic, point, 2, retain=True)
time.sleep(2)
I've confirmed that it is publishing on the 2-second schedule it's supposed to by looking at the broker it's publishing to.
Here is the Dockerfile that creates the image I run:
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
ADD requirements.txt /
ADD mqtt_client.py /
RUN pip3 install -r requirements.txt
CMD ["/mqtt_client.py"]
ENTRYPOINT ["/usr/local/bin/python3"]
Any ideas?