Merge lp:~facundo/magicicada-gui/dont-let-mq-die into lp:magicicada-gui

Proposed by Facundo Batista
Status: Merged
Approved by: Natalia Bidart
Approved revision: 53
Merged at revision: 56
Proposed branch: lp:~facundo/magicicada-gui/dont-let-mq-die
Merge into: lp:magicicada-gui
Diff against target: 41 lines (+13/-0)
2 files modified
magicicada/syncdaemon.py (+1/-0)
magicicada/tests/test_syncdaemon.py (+12/-0)
To merge this branch: bzr merge lp:~facundo/magicicada-gui/dont-let-mq-die
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
Review via email: mp+29023@code.launchpad.net

Description of the change

When calling last time to MQ updater, leave the caller in safe state.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Bu, I got this:

[ERROR]: magicicada.tests.test_syncdaemon.MetaQueueChangedTests.test_mq_caller_is_reset_last_time

Traceback (most recent call last):
  File "/home/nessita/projects/magicicada/review_dont-let-mq-die/magicicada/tests/test_syncdaemon.py", line 498, in test_mq_caller_is_reset_last_time
    self.sd.current_state._set(name='QUEUE_MANAGER',
  File "/home/nessita/projects/magicicada/review_dont-let-mq-die/magicicada/syncdaemon.py", line 56, in __getattribute__
    return object.__getattribute__(self, name)
exceptions.AttributeError: 'State' object has no attribute '_set'

review: Needs Fixing
54. By Facundo Batista <facundo@exopus>

Merged trunk in

55. By Facundo Batista <facundo@exopus>

Fix the test for new API after cleaning.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Now we're talking ;-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'magicicada/syncdaemon.py'
--- magicicada/syncdaemon.py 2010-06-27 22:19:42 +0000
+++ magicicada/syncdaemon.py 2010-07-08 22:41:01 +0000
@@ -253,6 +253,7 @@
253253
254 if not self.current_state.processing_meta:254 if not self.current_state.processing_meta:
255 logger.info("Check MQ called, States not in MQ, call a last time")255 logger.info("Check MQ called, States not in MQ, call a last time")
256 self._mqcaller = None
256 self._get_mq_data()257 self._get_mq_data()
257 else:258 else:
258 logger.info("Asking for MQ information")259 logger.info("Asking for MQ information")
259260
=== modified file 'magicicada/tests/test_syncdaemon.py'
--- magicicada/tests/test_syncdaemon.py 2010-06-27 22:19:42 +0000
+++ magicicada/tests/test_syncdaemon.py 2010-07-08 22:41:01 +0000
@@ -480,6 +480,8 @@
480 changed('QUEUE_MANAGER', 'description', False, True, False,480 changed('QUEUE_MANAGER', 'description', False, True, False,
481 'WORKING_ON_CONTENT', 'connection')481 'WORKING_ON_CONTENT', 'connection')
482 elif len(called) == 2:482 elif len(called) == 2:
483 # check that the caller is set back to None
484 self.assertTrue(self.sd._mqcaller is None)
483 deferred.callback(True)485 deferred.callback(True)
484 return defer.succeed("foo")486 return defer.succeed("foo")
485487
@@ -490,6 +492,16 @@
490 'WORKING_ON_BOTH', 'connection')492 'WORKING_ON_BOTH', 'connection')
491 return deferred493 return deferred
492494
495 def test_mq_caller_is_reset_last_time(self):
496 """When MQ is polled last time, the caller should be back to None."""
497 self.sd._mqcaller = reactor.callLater(100, lambda: None)
498 self.sd.current_state.set(name='QUEUE_MANAGER',
499 queues='WORKING_ON_CONTENT')
500
501 # call the method and check
502 self.sd._check_mq()
503 self.assertTrue(self.sd._mqcaller is None)
504
493 def test_mq_polling_untilfinish(self):505 def test_mq_polling_untilfinish(self):
494 """Check that it polls mq until no more is needed."""506 """Check that it polls mq until no more is needed."""
495 # set the callback, and adjust the polling time to faster507 # set the callback, and adjust the polling time to faster

Subscribers

People subscribed via source and target branches