Skip to content

Commit

Permalink
support for targeted message on the current peer uid
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Oct 6, 2018
1 parent 2181f65 commit 9d02399
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/appier/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4333,12 +4333,14 @@ def _load_supervisor(self):
# (new) peer events responsible for the global status consistency
self.bind_bus("update_peers", self._on_update_peers)
self.bind_bus("peer", self._on_peer)
self.bind_bus("peer-%s" % self.uid, self._on_self)

def _unload_supervisor(self):
# runs the unbind operation for the global events related with the
# peer updating operations (no longer needed)
self.unbind_bus("update_peers", self._on_update_peers)
self.unbind_bus("peer", self._on_peer)
self.unbind_bus("peer-%s" % self.uid, self._on_self)

def _add_handlers(self, logger):
for handler in self.handlers:
Expand Down Expand Up @@ -4770,6 +4772,18 @@ def _on_peer(self, data = None):
peer["ping"] = time.time()
self._peers[uid] = peer

def _on_self(self, data = None):
"""
Callback method to be called when a new request specifically
targeted for this peer is performed on the shared bus.
:type data: Dictionary
:param data: The map contain the detailed on the request that
has been performed.
"""

if not data: return

def _base_locale(self, fallback = "en_us"):
"""
Retrieves the locale considered to to be the base one for
Expand Down

0 comments on commit 9d02399

Please sign in to comment.