diff --git a/zaqar/storage/mongodb/messages.py b/zaqar/storage/mongodb/messages.py index ede09e839..39ed74654 100644 --- a/zaqar/storage/mongodb/messages.py +++ b/zaqar/storage/mongodb/messages.py @@ -645,7 +645,7 @@ class MessageController(storage.Message): for index, message in enumerate(messages) ] - ids = collection.insert(prepared_messages) + ids = collection.insert(prepared_messages, check_keys=False) return [str(id_) for id_ in ids] @@ -838,7 +838,7 @@ class FIFOMessageController(MessageController): # before the operation is abandoned is 49.95 seconds. for attempt in self._retry_range: try: - ids = collection.insert(prepared_messages) + ids = collection.insert(prepared_messages, check_keys=False) # Log a message if we retried, for debugging perf issues if attempt != 0: diff --git a/zaqar/tests/unit/storage/base.py b/zaqar/tests/unit/storage/base.py index 6fa15ec64..adbe96761 100644 --- a/zaqar/tests/unit/storage/base.py +++ b/zaqar/tests/unit/storage/base.py @@ -740,6 +740,28 @@ class MessageControllerTest(ControllerBaseTest): self.assertEqual(1, len(popped_messages)) + def test_message_period(self): + self.queue_controller.create(self.queue_name, project=self.project) + messages = [ + { + 'ttl': 60, + 'body': { + 'event.data': 'BackupStarted', + 'backupId': 'c378813c-3f0b-11e2-ad92-7823d2b0f3ce', + }, + }, + ] + + client_uuid = uuid.uuid1() + self.controller.post(self.queue_name, messages, client_uuid, + project=self.project) + + stored_messages = self.controller.list(self.queue_name, + project=self.project) + + self.assertItemsEqual(['event.data', 'backupId'], + list(next(stored_messages))[0]['body'].keys()) + def test_delete_message_from_nonexistent_queue(self): queue_name = 'fake_name' message_id = 'fake_id'