Skip to content

Commit

Permalink
fix(splat): wipe tmp directory after run
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper committed Nov 13, 2024
1 parent 265303a commit 1af3da9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import logging
import os
import pathlib
import subprocess
import sys
import tempfile
Expand Down Expand Up @@ -407,6 +408,12 @@ def lambda_handler(event: dict, context: dict) -> dict: # noqa
except Exception as e:
logger.error(f"splat|unknown_error|{str(e)}|stacktrace:", exc_info=True)
resp = SplatPDFGenerationFailure(status_code=500, message=str(e)).as_response().as_dict()
finally:
try:
execute(["rm", "-rf", "/tmp/*"])
except Exception as e:
logger.error(f"splat|cleanup_error|{str(e)}|stacktrace:", exc_info=True)

return resp


Expand Down

0 comments on commit 1af3da9

Please sign in to comment.