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

Error if AWS_SES_AUTO_THROTTLE set to None #218

Closed
curtismorales opened this issue Aug 11, 2021 · 9 comments · Fixed by #219
Closed

Error if AWS_SES_AUTO_THROTTLE set to None #218

curtismorales opened this issue Aug 11, 2021 · 9 comments · Fixed by #219

Comments

@curtismorales
Copy link
Contributor

If I set AWS_SES_AUTO_THROTTLE to None in my django settings, I get an error on initializing the SESBackend, I believe because of this commit coercing the setting to a float.

The README instructs users to set AWS_SES_AUTO_THROTTLE to None to turn off automatic throttling, as does a comment

Looks like this could be fixed by doing this coercion here or falling back to 0 here

In case it's helpful to see a traceback:

Traceback (most recent call last):                                                                                                                                                                   
  File "/usr/src/app/./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)                                                           
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()                                                                             
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)                                   
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)                                                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)                                                                                                                                                           
  File "/usr/src/app/scheduler/management/commands/send_test_email.py", line 24, in handle
    send_email(                                                                                   
  File "/usr/src/app/authapp/utils.py", line 70, in send_email
    email.send()                                                                                  
  File "/usr/local/lib/python3.9/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])                                                                                                                                    File "/usr/local/lib/python3.9/site-packages/django/core/mail/message.py", line 241, in get_connection
    self.connection = get_connection(fail_silently=fail_silently)
  File "/usr/local/lib/python3.9/site-packages/django/core/mail/__init__.py", line 35, in get_connection
    return klass(fail_silently=fail_silently, **kwds)                                                                                                                                                  File "/usr/local/lib/python3.9/site-packages/django_ses/__init__.py", line 63, in __init__
    self._throttle = float(aws_auto_throttle or settings.AWS_SES_AUTO_THROTTLE)
TypeError: float() argument must be a string or a number, not 'NoneType'   
@curtismorales
Copy link
Contributor Author

curtismorales commented Aug 11, 2021

Oh and I was able to work around this by setting settings.AWS_SES_AUTO_THROTTLE to 0

@pcraciunoiu
Copy link
Contributor

@curtismorales would you be open to making a PR for this? Could create this type of function and fall back to `None?

https://github.com/mozilla/kitsune/blob/46a8458f0e69245836440abe2b092c279d1eaec7/kitsune/sumo/utils.py#L86

@curtismorales
Copy link
Contributor Author

Yep, happy to. I'll open a PR when I have a minute.

@lukeburden
Copy link

Hi folks - did an upgrade and hit this issue due to the naive float coercion.

@pcraciunoiu and @curtismorales - looks like the PR for this is close to being done and just needs to be pushed over the line. Any chance you could make some time to complete the thought? It'll save others some hassle for sure.

@pcraciunoiu
Copy link
Contributor

pcraciunoiu commented Feb 16, 2022 via email

@lukeburden
Copy link

Hi @pcraciunoiu - I'm confused; what's wrong with @curtismorales's PR? He's got some tests.

If you're not actively maintaining this repo anymore, I recommend adjusting your readme so it states you're looking for new maintainers. Perhaps one of the many people using this library will have some spare time to help.

@pcraciunoiu
Copy link
Contributor

@lukeburden @curtismorales this has been released as part of v2.5.0 - https://pypi.org/project/django-ses/2.5.0/

@lukeburden I am maintaining the repo, but I'm not actively using the project. It's a good point though, I'll add something to the readme.

@curtismorales
Copy link
Contributor Author

My apologies on not wrapping up this conversation and fix back in August! Thanks @lukeburden for bumping it!

@lukeburden
Copy link

@pcraciunoiu amazing, thanks for that!

And no worries @curtismorales, thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants