var runQuery = function()

in lib/configuration.js [188:227]


  var runQuery = function(exclusiveStartKey) {
    var params = { TableName: config.configurationTable, Select: "ALL_ATTRIBUTES", KeyConditionExpression: "sourceArn = :sourceArn", FilterExpression: "active = :active", ExpressionAttributeValues: { ":active": { BOOL: true }, ":sourceArn": { S: source } } };
    if (exclusiveStartKey) {
      params.ExclusiveStartKey = exclusiveStartKey;
    }

    dynamo.query(params, function(err, data) {
      if(err) {
        console.error("An error occured while loading configuration data from Amazon DynamoDB table '" + config.configurationTable + "':", err);
        callback(new Error("Errors occured while loading configuration data from Amazon DynamoDB table '" + config.configurationTable + "':" + err), null);
        return;
      }

      if (data.hasOwnProperty('Items')) {
        // Add the targets to the list
        targets = targets.concat(data.Items);
      }

      if(data.ExclusiveStartKey) {
        // Still some data to get, query next batch of data
        runQuery(data.ExclusiveStartKey);
        return;
      }

      var entries = targets.map(function (t) { return readTarget(t, serviceDefinitions) }).filter(function(t) { return t != null });
      mappings[source] = {
        targets: entries,
        nextConfigurationRefresh: Date.now() + config.configRefreshDelay
      }

      if(config.debug) {
        console.log("Loaded configuration table ", config.configurationTable, "for function", process.env.AWS_LAMBDA_FUNCTION_NAME, "on source", source, "found", entries.length, "targets");
        entries.forEach(function(target) {
          console.log(" - Id:", target.id, "of type", target.type, "with destination", target.destination);
        });
      }

      callback(null, entries);
    });
  };