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

Don't log succesful SMS sends twice #490

Merged
merged 4 commits into from Feb 3, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/490.bugfix
@@ -0,0 +1 @@
Fix a bug introduced in Sydent 2.4.6 where errors communicating with openmarket would be logged as successes, and all successes would be logged twice.
9 changes: 1 addition & 8 deletions sydent/sms/openmarket.py
Expand Up @@ -151,6 +151,7 @@ async def sendTextSMS(
"Got response from sending SMS with malformed location header: %s",
value,
)
return
else:
ticket_id = parts[-1]

Expand All @@ -161,11 +162,3 @@ async def sendTextSMS(
request_id,
resp.code,
)

Copy link
Member

Choose a reason for hiding this comment

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

Not explicitly part of this PR, but should the above logger.error lines be accompanied with a return?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. What the dickens is happening here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tempted as I am to rewrite the whole thing, I'll be a good boy: stick in the return and call it a day.

logger.info(
"Successfully sent SMS (ticket ID: %s, request ID %s), OpenMarket API"
" responded with code %d",
parts[-1],
request_id,
resp.code,
)