diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-05-30 14:21:12 -0400 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-06-19 16:26:48 -0400 |
commit | 3539db640767e6dafa652864fc5a5445db4ee697 (patch) | |
tree | d707f794e06cead05b7a0f3f4fca349718d374de /src/pdmgen.py | |
parent | aabc54616fba1ad2c26acaf96ddf682ce3c263f0 (diff) | |
download | phosphor-dbus-monitor-3539db640767e6dafa652864fc5a5445db4ee697.tar.gz phosphor-dbus-monitor-3539db640767e6dafa652864fc5a5445db4ee697.zip |
Add deferrable callbacks
Deferrable callbacks delay callback invocation until a
pre configured length of time has elapsed. One example
scenario where deferrable callbacks help is to avoid
oscillation when testing a condition and making callbacks
frequently.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I180c99b57ec1c9bde4da76d947a026f809341c8a
Diffstat (limited to 'src/pdmgen.py')
-rwxr-xr-x | src/pdmgen.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pdmgen.py b/src/pdmgen.py index 5d4bf29..5e88e2c 100755 --- a/src/pdmgen.py +++ b/src/pdmgen.py @@ -532,6 +532,7 @@ class ConditionCallback(ConfigEntry, Renderer): def __init__(self, *a, **kw): self.condition = kw.pop('condition') self.instance = kw.pop('instance') + self.defer = kw.pop('defer', None) super(ConditionCallback, self).__init__(**kw) def factory(self, objs): @@ -580,6 +581,7 @@ class Condition(HasPropertyIndex): def __init__(self, *a, **kw): self.callback = kw.pop('callback') + self.defer = kw.pop('defer', None) super(Condition, self).__init__(**kw) def factory(self, objs): @@ -592,6 +594,7 @@ class Condition(HasPropertyIndex): 'callback': 'conditional', 'instance': self.callback, 'name': self.name, + 'defer': self.defer } callback = ConditionCallback(**args) |