[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
This commit is contained in:
wangxiyuan 2017-04-25 14:50:06 +08:00
parent c9bbd0b1bc
commit bdaae1e2a0

View File

@ -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