Worker Logic
I want this to listen always
Listen for UPDATE in the uServices object
544216
function uServicesManager(){

 client.publish('uServicesChannel', 'UPDATE');

 listenClient.on('message', function(channel, message) {

  client.get('uServices', function(err, reply) {
   if (reply !== null) {
    uServices = JSON.parse(reply);
   }
  });
 });

 listenClient.on("error", function (err) {
  console.log("Redis listen "+ err);
  listenClient.quit();
 });

 listenClient.subscribe('uServicesChannel');
}
149429
function _deliverAllChangeRecords() {
        var observers = observerCallbacks.slice();
        var anyWorkDone = false;
        for (var i = 0, l = observers.length; i < l; i++) {
            var observer = observers[i];
            if (_deliverChangeRecords(observer)) {
                anyWorkDone = true;
            }
        }
        return anyWorkDone;
    }
914765
void onJoinStart()
  {
    //long now = CurrentTime.getCurrentTime();
    ArrayList<UpdatePod> updatePods = new ArrayList<>();
    
    updateClusterRoot();

    /*
    for (UpdatePod updatePod : _podUpdateMap.values()) {
      if (updatePod.getSequence() == 0) {
        updatePods.add(new UpdatePod(updatePod, now));
      }
    }
    */
    
    /*
    for (UpdatePod updatePod : updatePods) {
      updatePod(updatePod);
    }
    */
    
    updatePods.addAll(_podUpdateMap.values());
    
    for (UpdatePod updatePod : updatePods) {
      updatePod(updatePod);
    }
    
    // XXX:
  }
1146499
def trigger(self, name, *args, **kwargs):
        

        # Relevant middleware is cached so we don't have to rediscover it
        # every time. Fetch the cached value if possible.

        listeners = self._triggers.get(name, [])

        # Execute each piece of middleware
        for listener in listeners:
            result = listener(*args, **kwargs)

            if result == break_trigger:
                return False

        return True
1142340
def listen(self, callback=None):
        """"""
        self._running = True
        self.loop.create_task(self._async_listen(callback))
1217593
def bind(self, __fun, *args, **kwargs):
    

    with self._lock:
      if self._running or self._completed or self._cancelled:
        raise RuntimeError('Future object can not be reused')
      if self._worker:
        raise RuntimeError('Future object is already bound')
      self._worker = functools.partial(__fun, *args, **kwargs)
    return self
1291349
def _listen_commands(self):
        

        self._last_update = None
        update_body = {'timeout': 2}

        while True:
            latest = self._last_update
            # increase offset to filter out older updates
            update_body.update({'offset': latest + 1} if latest else {})
            update_resp = self.client.get_updates(update_body)
            update_resp.add_done_callback(self._respond_commands)
            yield gen.sleep(5)
821803
function Worker(baseUrl, opts = {}) {

  if (!(this instanceof Worker)) {
    return new Worker(baseUrl, opts);
  }

  // inheritance
  Emitter.call(this);

  this.options = extend({
    workerId: uuid.v4()
  }, defaultOptions, opts);

  this.subscriptions = {};

  this.state = STATE_NEW;

  // apply extensions
  if (this.options.use) {
    this.extend(this.options.use);
  }

  // local variables
  this.engineApi = new EngineApi(
    baseUrl,
    this.options.requestOptions,
    this.options.apiVersion
  );

  if (this.options.pollingDelay) {
    throw new Error('options.pollingDelay got replaced with options.autoPoll');
  }

  // start
  if (this.options.autoPoll) {
    this.start();
  }
}
903047
protected function listen()
    {
        $this->eventEmitter->on('peridot.concurrency.pool.start-workers', [$this, 'onWorkersStart']);
        $this->eventEmitter->on('peridot.concurrency.worker.error', [$this, 'onError']);
        $broker = $this->pool->getMessageBroker();
        $broker->on('suite.start', [$this, 'onSuiteStart']);
        $broker->on('suite.end', [$this, 'onSuiteEnd']);
        $broker->on('test.passed', [$this, 'onTestPassed']);
        $broker->on('test.failed', [$this, 'onTestFailed']);
        $broker->on('test.pending', [$this, 'onTestPending']);
    }
748494
def workflow_update(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)
1272892
private void notifyHandler(ZoneHandlerClass handler, ApiZone apiZone, Object userAgent) {
        Object instance = handler.newInstance();
        callHandleMethod(handler.getHandleMethod(), instance, apiZone, userAgent);
    }
1266931
def check_updates(self, startup=False):
        
        from spyder.workers.updates import WorkerUpdates

        # Disable check_updates_action while the thread is working
        self.check_updates_action.setDisabled(True)

        if self.thread_updates is not None:
            self.thread_updates.terminate()

        self.thread_updates = QThread(self)
        self.worker_updates = WorkerUpdates(self, startup=startup)
        self.worker_updates.sig_ready.connect(self._check_updates_ready)
        self.worker_updates.sig_ready.connect(self.thread_updates.quit)
        self.worker_updates.moveToThread(self.thread_updates)
        self.thread_updates.started.connect(self.worker_updates.start)
        self.thread_updates.start()
1292608
def listener(self):
        ''''''
        channels = ['ql:w:' + self.client.worker_name]
        listener = Listener(self.client.redis, channels)
        thread = threading.Thread(target=self.listen, args=(listener,))
        thread.start()
        try:
            yield
        finally:
            listener.unlisten()
            thread.join()
5606
function onServices() {
  //debug('onServices');
  var numServices = Object.keys(this.services).length;
  if (!this.properties.tethering && numServices > 0) {
    //debug('update servicesCache');
    _servicesCache = this.services;
  }
}
525333
function update(user, callback) {
      var cb = callback || angular.noop;

      return User.update(user,
        function (user) {
          return cb(user);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
1145812
void handleDataToListener(String dataId, ConsumerConfig config, ProviderInfoListener listener) {
        if (!canNotify()) {
            return;
        }
        if (lastUserData != null) {
            ComposeUserData composeUserData = composeUserAndConfigData(lastUserData, lastConfigData);
            notifyToListener(listener, composeUserData);
        }
    }
500100
function listen(self, address, port, addressType, backlog, exclusive) {
    /* TODO Index servers by a self-assigned identifier and the process
     * identifier so messages intended for previous instances do not pass
     * through. */
    servers[port] = self; // Index servers by port.
    self._port = port; // Remember the requested port for close.
    process.send({
        cmd: 'CLUSTER_LISTEN',
        port: port,
        address: address, // For confirmation purposes only.
        addressType: addressType, // We allow the supervisor to infer the address type.
        backlog: backlog, // Used to confirm uniformity of worker requests.
        exclusive: exclusive // TODO use this on the other end
    });
}