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 enqueue race condition. #107

Merged
merged 1 commit into from Sep 15, 2016

Conversation

Projects
None yet
3 participants
@brycedrennan
Contributor

brycedrennan commented Sep 14, 2016

Sometimes emails in the queue will already have been processed before the first attempt here.

I discovered this when our full integration test was showing duplicate emails sent. This fixed the issue.

This is basically the same issue as #94

@coveralls

This comment has been minimized.

coveralls commented Sep 14, 2016

Coverage Status

Coverage decreased (-0.05%) to 93.613% when pulling 2f3d233 on CircleUp:enqueue-race into aced65a on slimta:master.

@@ -329,8 +329,9 @@ def enqueue(self, envelope):
for env, id in results:
if not isinstance(id, BaseException):
if self.relay:
self.active_ids.add(id)
self._pool_spawn('relay', self._attempt, id, env, 0)
if id not in self.active_ids:

This comment has been minimized.

@icgood

icgood Sep 15, 2016

Member

Nitpick, but would you collapse this if into one?

if self.relay and id not in self.active_ids:
    # ...

This comment has been minimized.

@brycedrennan

brycedrennan Sep 15, 2016

Contributor

done.

@coveralls

This comment has been minimized.

coveralls commented Sep 15, 2016

Coverage Status

Coverage decreased (-0.2%) to 93.5% when pulling 19a467b on CircleUp:enqueue-race into aced65a on slimta:master.

self._pool_spawn('relay', self._attempt, id, env, 0)
if self.relay and id not in self.active_ids:
self.active_ids.add(id)
self._pool_spawn('relay', self._attempt, id, env, 0)

This comment has been minimized.

@icgood

icgood Sep 15, 2016

Member

Sorry one more thing, pull back the indentation one more level on these two lines and you'll be good to go!

This comment has been minimized.

@brycedrennan

brycedrennan Sep 15, 2016

Contributor

whoops my bad. fixed.

Fix enqueue race condition.
Sometimes emails in the queue will already have been processed before the first attempt here.
@icgood

icgood approved these changes Sep 15, 2016

lgtm, will merge!

@coveralls

This comment has been minimized.

coveralls commented Sep 15, 2016

Coverage Status

Coverage remained the same at 93.667% when pulling d1b076e on CircleUp:enqueue-race into aced65a on slimta:master.

@icgood icgood merged commit b0e03a1 into slimta:master Sep 15, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 93.667%
Details

@icgood icgood added this to the 3.3 milestone Sep 15, 2016

@icgood

This comment has been minimized.

Member

icgood commented Sep 15, 2016

@brycedrennan just tagged and uploaded version 3.2.3 which contains this fix. Thanks!

@brycedrennan

This comment has been minimized.

Contributor

brycedrennan commented Sep 15, 2016

wow that's great! will make our deploy easier

@brycedrennan brycedrennan deleted the CircleUp:enqueue-race branch Sep 15, 2016

@icgood icgood modified the milestones: 3.3, 4.0 Nov 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment