Skip to content

Commit

Permalink
Refactoring (#35)
Browse files Browse the repository at this point in the history
* Refactored Dockerfile to reduce number of layers

* Reworded logger message of a successful connection attempt to make it clearer
  • Loading branch information
PatrickBaus authored Jan 21, 2025
1 parent ed837b3 commit 0dcd33a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ COPY --from=builder /opt/venv /opt/venv
# Enable venv
ENV PATH="/opt/venv/bin:$PATH"

COPY --from=builder /app /app
RUN chown -R worker:worker /app
COPY --from=builder --chown=worker:worker /app /app

USER worker

Expand Down
4 changes: 2 additions & 2 deletions database_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async def mqtt_producer(
**mqtt_config.model_dump(exclude={"hosts"}),
clean_session=not bool(mqtt_config.identifier),
) as client:
self.__logger.info("Connected producer to MQTT broker at '%s:%i'", hostname, port)
self.__logger.info("Successfully connected producer to MQTT broker at '%s:%i'", hostname, port)
await client.subscribe("sensors/#", qos=2)
async for message in client.messages:
# if message.topic.matches("sensors/+/+/+"):
Expand Down Expand Up @@ -286,7 +286,7 @@ async def mqtt_consumer(
**database_config.model_dump(exclude={"host"}),
) as conn:
self.__logger.info(
"Connected consumer (%s) to database at '%s:%i",
"Successfully connected consumer (%s) to database at '%s:%i",
worker_name,
*database_config.host,
)
Expand Down

0 comments on commit 0dcd33a

Please sign in to comment.