mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 03:38:12 +08:00
Bugfix to shutdown and restart for the test suite.
This commit is contained in:
@@ -91,17 +91,14 @@ class MBSConsumer(fedmsg.consumers.FedmsgConsumer):
|
||||
self.sanity_check()
|
||||
|
||||
def shutdown(self):
|
||||
log.info("Shutting down..")
|
||||
self.hub.stop()
|
||||
log.info("Scheduling shutdown.")
|
||||
from moksha.hub.reactor import reactor
|
||||
reactor.callFromThread(self.hub.stop)
|
||||
reactor.callFromThread(reactor.stop)
|
||||
|
||||
def consume(self, message):
|
||||
log.info("Received %r" % message)
|
||||
|
||||
if self.stop_condition and self.stop_condition(message):
|
||||
return self.shutdown()
|
||||
|
||||
# Sometimes, the messages put into our queue are artificially put there
|
||||
# by other parts of our own codebase. If they are already abstracted
|
||||
# messages, then just use them as-is. If they are not already
|
||||
@@ -120,6 +117,9 @@ class MBSConsumer(fedmsg.consumers.FedmsgConsumer):
|
||||
log.exception('Failed while handling {0!r}'.format(msg.msg_id))
|
||||
log.info(msg)
|
||||
|
||||
if self.stop_condition and self.stop_condition(message):
|
||||
self.shutdown()
|
||||
|
||||
def get_abstracted_msg(self, message):
|
||||
# Convert the message to an abstracted message
|
||||
if conf.messaging == 'fedmsg':
|
||||
|
||||
@@ -189,6 +189,7 @@ class TestBuild(unittest.TestCase):
|
||||
import sys
|
||||
del sys.modules['twisted.internet.reactor']
|
||||
del sys.modules['moksha.hub.reactor']
|
||||
del sys.modules['moksha.hub']
|
||||
import moksha.hub.reactor
|
||||
|
||||
@timed(30)
|
||||
|
||||
Reference in New Issue
Block a user