Mercurial > prosody-hg
diff util/async.lua @ 5794:66c3ad5d29ad
util.async: Fix logic bug that prevented error watcher being called for runners
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 13 Aug 2013 19:23:00 +0100 |
| parents | e8c79796ead9 |
| children | 0b66cb959161 |
line wrap: on
line diff
--- a/util/async.lua Mon Aug 12 13:22:27 2013 +0200 +++ b/util/async.lua Tue Aug 13 19:23:00 2013 +0100 @@ -103,8 +103,12 @@ n = #q; end self.state = state; - if state ~= self.notified_state then - self.notified_state = state; + if err or state ~= self.notified_state then + if err then + state = "error" + else + self.notified_state = state; + end local handler = self.watchers[state]; if handler then handler(self, err); end end
