vox-server/interchangedb.js
function _queryForTargetSessions(url, minDbSeq) {
    var where = { isConnected: true };
    if (minDbSeq) {
      where.connectedAtDbSeq = { gt: minDbSeq };
    }
    return Session.findAll({
        where: where,
        attributes: [
            'sessionId',
            'connectedAtDbSeq',
        ],
        include: [{
            model: Route,
            where: { routeUrl: url, weight: { gt: 0 } },
            attributes: []
        }],
        group: '`Session`.`sessionId`',
    }, { raw: true })
    .then(function(sessions) {
      var sessionIds = [];
      var dbSeq = -1;
      for (var i = 0; i < sessions.length; i++) {
        var session = sessions[i];
        var sessionId = session['sessionId'];
        sessionIds.push(sessionId);
        dbSeq = Math.max(session['connectedAtDbSeq'], dbSeq);
      }
      return { sessionIds: sessionIds, dbSeq: dbSeq };
    })
  }
function _queryForTargetSessions(url, minDbSeq) {
    var where = { isConnected: true };
    if (minDbSeq) {
      where.connectedAtDbSeq = { gt: minDbSeq };
    }
    return Session.findAll({
        where: where,
        attributes: [
            'sessionId',
            'connectedAtDbSeq',
        ],
        include: [{
            model: Route,
            where: { routeUrl: url, weight: { gt: 0 } },
            attributes: []
        }],
        group: '`Session`.`sessionId`',
    }, { raw: true })
    .then(function(sessions) {
      var sessionIds = [];
      var dbSeq = -1;
      for (var i = 0; i < sessions.length; i++) {
        var session = sessions[i];
        var sessionId = session['sessionId'];
        sessionIds.push(sessionId);
        dbSeq = Math.max(session['connectedAtDbSeq'], dbSeq);
      }
      return { sessionIds: sessionIds, dbSeq: dbSeq };
    })
  }
function _queryForTargetSessions ( url , minDbSeq ) { var where = { isConnected : true } ; if ( minDbSeq ) { where . connectedAtDbSeq = { gt : minDbSeq } ; } return Session . findAll ( { where : where , attributes : [ 'sessionId' , 'connectedAtDbSeq' , ] , include : [ { model : Route , where : { routeUrl : url , weight : { gt : 0 } } , attributes : [ ] } ] , group : '`Session`.`sessionId`' , } , { raw : true } ) . then ( function ( sessions ) { var sessionIds = [ ] ; var dbSeq = - 1 ; for ( var i = 0 ; i < sessions . length ; i ++ ) { var session = sessions [ i ] ; var sessionId = session [ 'sessionId' ] ; sessionIds . push ( sessionId ) ; dbSeq = Math . max ( session [ 'connectedAtDbSeq' ] , dbSeq ) ; } return { sessionIds : sessionIds , dbSeq : dbSeq } ; } ) }
Queries for sessions that are connected and also have an active route for
the given URL.

@param {String} url The routeUrl to query for.
@param {Number} [minDbSeq] The minimum connectedAtDbSeq to query for.
Queries for sessions that are connected and also have an active route for the given URL .