Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error logging, address potential db error #3151

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions queue_services/auth-queue/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion queue_services/auth-queue/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pyasn1_modules = "0.4.0"
pycountry = "23.12.11"
pyrsistent = "0.20.0"
python-dateutil = "2.9.0.post0"
pytz = "2024.1"
pytz = "2024.2"
rsa = "4.9"
semver = "3.0.2"
six = "1.16.0"
Expand Down
6 changes: 3 additions & 3 deletions queue_services/auth-queue/src/auth_queue/resources/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def worker():
elif event_message.type in [QueueMessageTypes.NSF_UNLOCK_ACCOUNT.value,
QueueMessageTypes.NSF_LOCK_ACCOUNT.value]:
process_pay_lock_unlock_event(event_message)
except Exception: # NOQA # pylint: disable=broad-except
logger.error('Error processing event:', exc_info=True)
except Exception as e: # NOQA # pylint: disable=broad-except
logger.error('Error processing event: %', str(e))
Copy link
Collaborator

@seeker25 seeker25 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not equivalent, doesn't print the stack trace? Only prints the error

EG. before:
ValueError
blah blah line 403
line 340930

now: Will print Error processing event: ValueError

# Return a 200, so the event is removed from the Queue
return {}, HTTPStatus.OK

Expand Down Expand Up @@ -188,7 +188,7 @@ def process_name_events(event_message: SimpleCloudEvent):
and str(auth_account_id).isnumeric():
logger.info('Account ID received : %s', auth_account_id)
# Auth account id can be service account value too, so doing a query lookup than find_by_id
org: OrgModel = db.session.query(OrgModel).filter(OrgModel.id == auth_account_id).one_or_none()
org: OrgModel = db.session.query(OrgModel).filter(OrgModel.id == int(auth_account_id or -1)).one_or_none()
# If account is present and is not a gov account, then affiliate.
if org and org.access_type != AccessType.GOVM.value:
nr_entity.pass_code_claimed = True
Expand Down