kazoo icon indicating copy to clipboard operation
kazoo copied to clipboard

DataWatch is using TypeError to detect the arity of callback function

Open liudangyi opened this issue 8 years ago • 0 comments

In kazoo/recipe/watchers.py line 163.

            try:
                result = self._func(data, stat, event)
            except TypeError:
                result = self._func(data, stat)

It's too terrible since a lot of error could raise a TypeError. Two better ways may be

  1. Like ChildrenWatch, add a send_event parameter.
  2. Use len(inspect.getargspec(self._func).args) to decide the arity first.

liudangyi avatar Aug 23 '17 22:08 liudangyi