Skip to content

Commit

Permalink
Fix: Logs to file shrinkage policy, and adjust health check rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tristiisch committed May 26, 2024
1 parent 7069f49 commit b53b8f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ RUN pip install -e .
# Add the virtual environment to the PATH
ENV PATH="/opt/venv/bin:$PATH"

HEALTHCHECK --interval=5s --retries=3 --timeout=5s CMD python ./src/cli.py health
HEALTHCHECK --interval=30s --retries=3 --timeout=30s CMD python ./src/cli.py health
# Socket port for external health
EXPOSE 49150

Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/connector/deezer/py_deezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ async def get_track_download_url(
track = track["DATA"] if "DATA" in track else track

if "MD5_ORIGIN" not in track:
raise DownloadLinkDecryptionError("MD5 is needed to decrypt the download link.")
raise DownloadLinkDecryptionError("MD5 of track is needed to decrypt the download link.")

md5_origin = track["MD5_ORIGIN"]
track_id = track["SNG_ID"]
Expand Down
5 changes: 3 additions & 2 deletions src/pyramid/tools/logs_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self):
self.__console_format = "%(asctime)s %(levelname)s %(message)s"
self.__file_format = "[{asctime}] [{levelname:<8}] {name}: {message}"

def init(self, info: ApplicationInfo, logs_dir, log_filename, error_filename):
def init(self, info: ApplicationInfo, logs_dir: str, log_filename: str, error_filename: str):
self.__info = info
self.__logs_dir = logs_dir
self.__log_filename = log_filename
Expand Down Expand Up @@ -46,7 +46,8 @@ def log_to_file(self):
self.logger.addHandler(file_handler)

def log_to_file_exceptions(self):
log_filename = os.path.join(self.__logs_dir, self.__error_filename)
log_filename = os.path.join(self.__logs_dir, "errors", self.__error_filename)
tools.create_parent_directories(log_filename)

file_handler = logging.handlers.RotatingFileHandler(
filename=log_filename,
Expand Down

0 comments on commit b53b8f0

Please sign in to comment.