Change in vdsm[master]: stomp: use the atomic dict.setdefault() instead for check an...

smizrahi at redhat.com smizrahi at redhat.com
Sun Dec 7 21:29:24 UTC 2014


Saggi Mizrahi has uploaded a new change for review.

Change subject: stomp: use the atomic dict.setdefault() instead for check and set
......................................................................

stomp: use the atomic dict.setdefault() instead for check and set

This is faster and simpler.

Change-Id: I28e4925a78328c4ac6cd0b9fc8659d6a3ee27a8f
Signed-off-by: Saggi Mizrahi <smizrahi at redhat.com>
---
M lib/yajsonrpc/stomp.py
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/35937/1

diff --git a/lib/yajsonrpc/stomp.py b/lib/yajsonrpc/stomp.py
index 1dda6d7..04c23ba 100644
--- a/lib/yajsonrpc/stomp.py
+++ b/lib/yajsonrpc/stomp.py
@@ -218,8 +218,7 @@
         # the first header entry SHOULD be used as the value of header entry.
         # Subsequent values are only used to maintain a history of state
         # changes of the header and MAY be ignored.
-        if key not in headers:
-            headers[key] = value
+        headers.setdefault(key, value)
 
         return True
 


-- 
To view, visit http://gerrit.ovirt.org/35937
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28e4925a78328c4ac6cd0b9fc8659d6a3ee27a8f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi at redhat.com>


More information about the vdsm-patches mailing list