From: David Stainton Date: Thu, 28 Jan 2016 17:43:01 +0000 (+0000) Subject: Daira's fix to the hook mixin X-Git-Url: https://git.rkrishnan.org/pf/content/en/service?a=commitdiff_plain;h=3c5f8d2949715f5d52b0dffaff971125409a2f4a;p=tahoe-lafs%2Ftahoe-lafs.git Daira's fix to the hook mixin --- diff --git a/src/allmydata/util/deferredutil.py b/src/allmydata/util/deferredutil.py index 34aa3777..9a212378 100644 --- a/src/allmydata/util/deferredutil.py +++ b/src/allmydata/util/deferredutil.py @@ -101,7 +101,7 @@ class HookMixin: self._hooks[name] = (d, ignore_count) return d - def _call_hook(self, res, name): + def _call_hook(self, res, name, async=False): """ Called to trigger the hook, with argument 'res'. This is a no-op if the hook is unset. If the hook's ignore_count is positive, it will be @@ -124,7 +124,10 @@ class HookMixin: self._hooks[name] = (d, ignore_count - 1) else: self._hooks[name] = None - _with_log(eventually_callback(d), res) + if async: + _with_log(eventually_callback(d), res) + else: + _with_log(d.callback, res) return res def _log(self, msg):