Skip to content

Commit

Permalink
Merge pull request #660 from MasoniteFramework/fix-659
Browse files Browse the repository at this point in the history
closes connections now
  • Loading branch information
josephmancuso committed Apr 1, 2019
2 parents df17b94 + 6627769 commit 4277649
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions masonite/drivers/QueueAmqpDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def _publish(self, body):
properties=self.pika.BasicProperties(
delivery_mode=2, # make message persistent
))
self.channel.close()
self.connection.close()

def push(self, *objects, args=(), callback='handle', ran=1, channel=None):
"""Push objects onto the amqp stack.
Expand Down Expand Up @@ -89,7 +91,13 @@ def consume(self, channel, fair=False):

if fair:
self.channel.basic_qos(prefetch_count=1)
return self.channel.start_consuming()

try:
self.channel.start_consuming()
finally:
self.channel.stop_consuming()
self.channel.close()
self.connection.close()

def work(self, ch, method, properties, body):
from wsgi import container
Expand All @@ -109,10 +117,7 @@ def work(self, ch, method, properties, body):
except AttributeError:
obj(*args)

try:
self.success('[\u2713] Job Successfully Processed')
except UnicodeEncodeError:
self.success('[Y] Job Successfully Processed')
self.success('[\u2713] Job Successfully Processed')
except Exception as e:
self.danger('Job Failed: {}'.format(str(e)))

Expand Down
2 changes: 1 addition & 1 deletion masonite/info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Module for specifying the Masonite version in a central location."""

VERSION = '2.1.24'
VERSION = '2.1.25'

0 comments on commit 4277649

Please sign in to comment.