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/components//%22%22.?a=commitdiff_plain;h=a3f727cb88d9dc5d8718d342079619e38e1b2944;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):