• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hypothesis / h / 9939
70%
master: 97%

Build:
Build:
LAST BUILD BRANCH: realtime-update-v1-h-only-1
DEFAULT BRANCH: master
Ran 02 Feb 2016 01:38PM UTC
Jobs 1
Files 97
Run time 3s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
9939

push

travis-ci

seanh
Send activation emails from a worker process

Send new user account activation emails from a worker process, instead of from
the main application thread.

This avoids a problem when the register view is called and sending the email
(mailer.send(message)) raises an exception *but the email was actually sent*.
The transaction would be rolled back and the user account not created, and the
user would receive an unusable "please activate your account" email.

Changes:

- The register view callable now puts a message on a new "activations"
  nsq topic, instead of actually sending the email.

- The new h/accounts/worker.py is a hypothesis-worker that subscribes to the
  new "activations" topic and actually sends an email for each message
  published to the toipic.

- Update accounts/test/views_test.py to fix broken tests.
  These were mainly broken because _register() now accesses
  request.get_queue_writer() and Pyramid's DummyRequest() objects don't have
  that method. Just use a mock.Mock() instead.
  In a couple of places assertions had to be updated as well.

In sending the email fails (if pyramid_mailer's send_immediately() raises) then
the message will be requeued (this is gnsq's default behavior when a worker
function raises an exception) and the worker will try again to send it.

Note that we don't attempt to prevent sending the same activation email
multiple times if a message published to the "activations" topic is received by
the worker multiple times. This may happen, since nsq guarantees
"at least once" delivery. If this becomes a problem we may need to set a flag
in the database to record when a particular activation email has already been
sent successfully.

2679 of 3817 relevant lines covered (70.19%)

0.7 hits per line

Jobs
ID Job ID Ran Files Coverage
1 9939.1 02 Feb 2016 01:38PM UTC 0
70.19
Travis Job 9939.1
Source Files on build 9939
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #9939
  • 49b24124 on github
  • Next Build on send-activation-emails-from-worker (#9941)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc