Skip to content

Commit

Permalink
Warn on rollbar if document already exists and so not overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-dxw committed Apr 14, 2023
1 parent 64002b1 commit ee0627c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions queue_listener/queue_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

dotenv.load_dotenv()

rollbar.init(os.getenv("ROLLBAR_ACCESS_TOKEN"))
rollbar.init(
os.getenv("ROLLBAR_ACCESS_TOKEN"),
environment=os.getenv("ROLLBAR_ENV", default="unknown"),
)
QUEUE_URL = os.getenv("QUEUE_URL")
# should be UNSET whenever using actual AWS
# but set if we're using localstack
Expand Down Expand Up @@ -69,7 +72,9 @@ def handle_message(message):
upload_key = key_no_extension + ".pdf"

if would_replace_custom_pdf(bucket_name, upload_key):
print(f"{upload_key} is from custom-pdfs, not replacing")
rollbar_message = f"existing '{upload_key}' is from custom-pdfs, pdf-conversion is not overwriting it"
rollbar.report_message(rollbar_message, "warning")
print(rollbar_message)
continue

print(f"Downloading {download_key}")
Expand Down

0 comments on commit ee0627c

Please sign in to comment.