Skip to contentSkip to conversation

master - lvmdbusd: Reduce unnecessary state refreshes

PATCH tasleson 1 participant 1 message Feb 25, 2016

lore
Share & tools
lore

tasleson

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f1bc68beb4e493a9c1a52750e99d50f874ca89d9
Commit:        f1bc68beb4e493a9c1a52750e99d50f874ca89d9
Parent:        045d086a570d327b00a4a06d139b387d059ade60
Author:        Tony Asleson <[email protected]>
AuthorDate:    Thu Feb 25 14:57:12 2016 -0600
Committer:     Tony Asleson <[email protected]>
CommitterDate: Thu Feb 25 16:43:55 2016 -0600

lvmdbusd: Reduce unnecessary state refreshes

When we use udev or have lvm call back into the dbus service when a change occurs, even if that change originated from the dbus service we end up refreshing the state of the system twice which is not needed or wanted. This change handles this case by removing any pending refreshes in the worker queue if the state of the system was just updated.

---
 daemons/lvmdbusd/lvmdb.py |    3 +--
 daemons/lvmdbusd/main.py  |   43 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 37 insertions(+), 9 deletions(-)
daemons/lvmdbusd/lvmdb.py +1 -2
index 46e2099..132bee7 100755
@@ -272,10 +272,9 @@ class DataStore(object):
 		:param log  Add debug log entry/exit messages
 		:return: None
 		"""
-
+		self.num_refreshes += 1
 		if log:
 			log_debug("lvmdb - refresh entry")
-			self.num_refreshes += 1
 
 		# Grab everything first then parse it
 		_raw_pvs = cmdhandler.pv_retrieve_with_segs()
daemons/lvmdbusd/main.py +36 -7

69 lines not on this page · raw message