Trigger synchronization of all active organizations
438880
def perform(name = nil, count = nil)
      Maestrano::Connector::Rails::Organization
        .where.not(oauth_provider: nil, encrypted_oauth_token: nil)
        .where(sync_enabled: true)
        .select(:id)
        .find_each do |organization|
        Maestrano::Connector::Rails::SynchronizationJob.set(wait: rand(3600)).perform_later(organization.id, {})
      end
    end
693348
def notify_engine_activated(self, chain_head):
        """"""
        chain_head_bytes = chain_head.SerializeToString()
        self._notify(
            "consensus_notifier_notify_engine_activated",
            chain_head_bytes,
            len(chain_head_bytes))
906290
def sync():
    '''
    
    '''
    # Funtoo patches eix to use 'ego sync'
    if __grains__['os'] == 'Funtoo':
        cmd = 'eix-sync -q'
    else:
        cmd = 'eix-sync -q -C "--ask" -C "n"'
    if 'makeconf.features_contains' in __salt__ and __salt__['makeconf.features_contains']('webrsync-gpg'):
        # GPG sign verify is supported only for "webrsync"
        if salt.utils.path.which('emerge-delta-webrsync'):  # We prefer 'delta-webrsync' to 'webrsync'
            cmd += ' -W'
        else:
            cmd += ' -w'
        return __salt__['cmd.retcode'](cmd) == 0
    else:
        if __salt__['cmd.retcode'](cmd) == 0:
            return True
        # We fall back to "webrsync" if "rsync" fails for some reason
        if salt.utils.path.which('emerge-delta-webrsync'):  # We prefer 'delta-webrsync' to 'webrsync'
            cmd += ' -W'
        else:
            cmd += ' -w'
        return __salt__['cmd.retcode'](cmd) == 0
1264593
def sync(
    ctx,
    state,
    bare=False,
    user=False,
    unused=False,
    **kwargs
):
    """"""
    from ..core import do_sync

    retcode = do_sync(
        ctx=ctx,
        dev=state.installstate.dev,
        three=state.three,
        python=state.python,
        bare=bare,
        dont_upgrade=(not state.installstate.keep_outdated),
        user=user,
        clear=state.clear,
        unused=unused,
        sequential=state.installstate.sequential,
        pypi_mirror=state.pypi_mirror,
    )
    if retcode:
        ctx.abort()
1150927
def _on_automation_update(self, event):
        """"""
        event_group = TIMELINE.AUTOMATION_EDIT_GROUP

        if isinstance(event, (tuple, list)):
            event = event[0]

        for callback in self._event_callbacks.get(event_group, ()):
            _execute_callback(callback, event)
944663
function triggerEvents (list, args, context) {
  var pass = true

  if (list) {
    var i = 0
    var l = list.length
    var a1 = args[0]
    var a2 = args[1]
    var a3 = args[2]
    // call is faster than apply, optimize less than 3 argu
    // http://blog.csdn.net/zhengyinhui100/article/details/7837127
    switch (args.length) {
      case 0: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context) !== false && pass} break
      case 1: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1) !== false && pass} break
      case 2: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2) !== false && pass} break
      case 3: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2, a3) !== false && pass} break
      default: for (; i < l; i += 2) {pass = list[i].apply(list[i + 1] || context, args) !== false && pass} break
    }
  }
  // trigger will return false if one of the callbacks return false
  return pass
}
1248266
def sync(self):
        """"""
        self.elk.send(ka_encode())
        self.get_descriptions(TextDescriptions.KEYPAD.value)
703061
function sync() {
    syncDom.setAttribute('data-sync-state', 'syncing');
    var opts = {continuous: true, complete: syncError};
    db.replicate.to(remoteCouch, opts);
    db.replicate.from(remoteCouch, opts);
  }
605949
def ensure_active_group(self):
        """"""
        with self._client._lock, self._lock:
            if self._heartbeat_thread is None:
                self._start_heartbeat_thread()

            while self.need_rejoin() or self._rejoin_incomplete():
                self.ensure_coordinator_ready()

                # call on_join_prepare if needed. We set a flag
                # to make sure that we do not call it a second
                # time if the client is woken up before a pending
                # rebalance completes. This must be called on each
                # iteration of the loop because an event requiring
                # a rebalance (such as a metadata refresh which
                # changes the matched subscription set) can occur
                # while another rebalance is still in progress.
                if not self.rejoining:
                    self._on_join_prepare(self._generation.generation_id,
                                          self._generation.member_id)
                    self.rejoining = True

                # ensure that there are no pending requests to the coordinator.
                # This is important in particular to avoid resending a pending
                # JoinGroup request.
                while not self.coordinator_unknown():
                    if not self._client.in_flight_request_count(self.coordinator_id):
                        break
                    self._client.poll()
                else:
                    continue

                # we store the join future in case we are woken up by the user
                # after beginning the rebalance in the call to poll below.
                # This ensures that we do not mistakenly attempt to rejoin
                # before the pending rebalance has completed.
                if self.join_future is None:
                    # Fence off the heartbeat thread explicitly so that it cannot
                    # interfere with the join group. Note that this must come after
                    # the call to _on_join_prepare since we must be able to continue
                    # sending heartbeats if that callback takes some time.
                    self._heartbeat_thread.disable()

                    self.state = MemberState.REBALANCING
                    future = self._send_join_group_request()

                    self.join_future = future  # this should happen before adding callbacks

                    # handle join completion in the callback so that the
                    # callback will be invoked even if the consumer is woken up
                    # before finishing the rebalance
                    future.add_callback(self._handle_join_success)

                    # we handle failures below after the request finishes.
                    # If the join completes after having been woken up, the
                    # exception is ignored and we will rejoin
                    future.add_errback(self._handle_join_failure)

                else:
                    future = self.join_future

                self._client.poll(future=future)

                if future.succeeded():
                    self._on_join_complete(self._generation.generation_id,
                                           self._generation.member_id,
                                           self._generation.protocol,
                                           future.value)
                    self.join_future = None
                    self.rejoining = False

                else:
                    self.join_future = None
                    exception = future.exception
                    if isinstance(exception, (Errors.UnknownMemberIdError,
                                              Errors.RebalanceInProgressError,
                                              Errors.IllegalGenerationError)):
                        continue
                    elif not future.retriable():
                        raise exception  # pylint: disable-msg=raising-bad-type
                    time.sleep(self.config['retry_backoff_ms'] / 1000)
1139639
def trigger_events(events, loop):
    
    for event in events:
        result = event(loop)
        if isawaitable(result):
            loop.run_until_complete(result)
549438
def trigger_org_task(task_name, queue="celery"):
    
    active_orgs = apps.get_model("orgs", "Org").objects.filter(is_active=True)
    for org in active_orgs:
        sig = signature(task_name, args=[org.pk])
        sig.apply_async(queue=queue)

    logger.info("Requested task '%s' for %d active orgs" % (task_name, len(active_orgs)))
1291052
def sync_objects_in(self):
        """"""
        self.dstate = self.STATES.BUILDING
        self.build_source_files.record_to_objects()
467513
public function syncActiveRecord( $event ) {

        $synchronizer = $this->getSynchonizer();

        $function = $this->canSyncActiveRecord;
        $flag     = true;
        $model    = $event->sender;

        if ( is_callable( $function ) && ( $function instanceof Closure ) ) {
            $flag = $function( $model );
        }

        if ($flag) {
            foreach ( $this->syncServices as $serviceName ) {
                $synchronizer->syncActiveRecord( $serviceName, $model );
            }
        }
    }
61307
def group_callback(self, iocb):
        """"""
        if _debug: IOGroup._debug("group_callback %r", iocb)

        # check all the members
        for iocb in self.ioMembers:
            if not iocb.ioComplete.isSet():
                if _debug: IOGroup._debug("    - waiting for child: %r", iocb)
                break
        else:
            if _debug: IOGroup._debug("    - all children complete")
            # everything complete
            self.ioState = COMPLETED
            self.trigger()
1235703
def broadcast
      synchronize do
        @threads.dup.each do |t|
          t.wakeup if t.alive? && t.stop?
        end
      end
    end
242116
def sync!
      events = @matrix.sync since: @since
      process_sync events
    rescue ApiError => err
      broadcast(:sync_error, err)
    end
1372749
def sync_groups(self):
        """"""
        if self.settings.GROUP_FILTER:
            ldap_groups = self.ldap.search(self.settings.GROUP_FILTER, self.settings.GROUP_ATTRIBUTES.keys())
            self._sync_ldap_groups(ldap_groups)
            logger.info("Groups are synchronized")