<commit_before>Settings = {
  maxCollectionSpace: 6 * 1024 * 1024, // 6 MB
  maxCollectionNum: 10000 // Number of docs in collection
};

var Future = Npm.require('fibers/future');

WikiEdits = new Mongo.Collection('wikiedits');
WikiEdits._createCappedCollection(Settings.maxCollectionSpace, Settings.maxCollectionNum);

var wikichanges = Npm.require('wikichanges');

Wikipedias = _.map(_.keys(wikichanges.wikipedias), function(channelName) {
  return {
    channel: channelName,
    name: wikichanges.wikipedias[channelName].long,
    code: wikichanges.wikipedias[channelName].short,
  };
});

Wikipedias.push({ channel: '#all', name: 'All Wikipedia', code: 'zz' });

if (Meteor.settings.doJobs) {
  var changeListener = Future.task(function() {
    return new wikichanges.WikiChanges({ircNickname: 'internet-dashboard'});
  }).wait();

  changeListener.listen(Meteor.bindEnvironment(function(change) {
    change.ts = new MongoInternals.MongoTimestamp(0, 0);
    change.created = new Date();
    WikiEdits.insert(change);
  }));
  console.log('WikiData: Listening for wiki edits');
}

Meteor.publish('wikipedias', function() {
  _.each(Wikipedias, function(channel) {
    this.added('wikipedias', channel.channel, channel);
  }, this);
  this.ready();
});
<commit_msg>add needed indices - #12801<commit_after>Settings = {
  maxCollectionSpace: 6 * 1024 * 1024, // 6 MB
  maxCollectionNum: 10000 // Number of docs in collection
};

var Future = Npm.require('fibers/future');

WikiEdits = new Mongo.Collection('wikiedits');
WikiEdits._createCappedCollection(Settings.maxCollectionSpace, Settings.maxCollectionNum);
WikiEdits._ensureIndex({ namespace: 1, channel: 1 });
WikiEdits._ensureIndex({ created: -1 });

var wikichanges = Npm.require('wikichanges');

Wikipedias = _.map(_.keys(wikichanges.wikipedias), function(channelName) {
  return {
    channel: channelName,
    name: wikichanges.wikipedias[channelName].long,
    code: wikichanges.wikipedias[channelName].short,
  };
});

Wikipedias.push({ channel: '#all', name: 'All Wikipedia', code: 'zz' });

if (Meteor.settings.doJobs) {
  var changeListener = Future.task(function() {
    return new wikichanges.WikiChanges({ircNickname: 'internet-dashboard'});
  }).wait();

  changeListener.listen(Meteor.bindEnvironment(function(change) {
    change.ts = new MongoInternals.MongoTimestamp(0, 0);
    change.created = new Date();
    WikiEdits.insert(change);
  }));
  console.log('WikiData: Listening for wiki edits');
}

Meteor.publish('wikipedias', function() {
  _.each(Wikipedias, function(channel) {
    this.added('wikipedias', channel.channel, channel);
  }, this);
  this.ready();
});

{'fraction_non_alphanumeric': 0.15073668303740084, 'fraction_numerical': 0.015867019267094825, 'mean_word_length': 5.172494172494172, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6251608', 'n_tokens_mistral': 935, 'n_tokens_neox': 873, 'n_words': 163}