From bdaae1e2a0927be507ddaf577b86049a35f5e8f2 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Tue, 25 Apr 2017 14:50:06 +0800 Subject: [PATCH] [Swift] Fix 503 error when get queue stats when use swift backend, if there is only one message in a queue, then try to get the queue 's stats, Zaqar will raise 503 error. It's because that Swift backend used shallow copy which is wrong. Closes-bug: #1686021 Change-Id: Ie563ff63ea90e7011a6ece525f5e7795109ba1d0 --- zaqar/storage/swift/messages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zaqar/storage/swift/messages.py b/zaqar/storage/swift/messages.py index f1ddb4666..e1cf6069c 100644 --- a/zaqar/storage/swift/messages.py +++ b/zaqar/storage/swift/messages.py @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import copy import functools import uuid @@ -329,7 +330,7 @@ class MessageQueueHandler(object): 'age': now - created, 'created': timeutils.iso8601_from_timestamp(created)} if oldest is None: - oldest = newest + oldest = copy.deepcopy(newest) total += 1 if headers.get('x-object-meta-claimid'): claimed += 1