Remove redundant ternary on SMS client FROM_NUMBER

Logs over the past 14 days confirm we never call this code with
None as the sender, so it's safe to remove the ternary.
This commit is contained in:
Ben Thorner
2022-04-12 14:58:34 +01:00
parent 385be77d67
commit 44d90b0a4f
2 changed files with 1 additions and 30 deletions

View File

@@ -23,7 +23,6 @@ class SmsClient(Client):
def init_app(self, current_app, statsd_client):
self.current_app = current_app
self.statsd_client = statsd_client
self.from_number = self.current_app.config.get('FROM_NUMBER')
def record_outcome(self, success):
log_message = "Provider request for {} {}".format(
@@ -41,15 +40,6 @@ class SmsClient(Client):
def send_sms(self, to, content, reference, international, sender):
start_time = monotonic()
if sender is None:
# temporary log to see if the following ternary is necessary
# or if it's safe to remove it - keep for 1-2 weeks
self.current_app.logger.warning(
f"send_sms called with 'sender' of 'None' for {reference}"
)
sender = self.from_number if sender is None else sender
try:
response = self.try_send_sms(to, content, reference, international, sender)
self.record_outcome(True)