<commit_before>tpCronJobs = new Mongo.Collection('tp_cronJobs');

Meteor.startup(() => {
  tpCronJobs.find().observe({
    added: function(doc) {
      addJob(doc);
    },
    removed: function(doc) {
      SyncedCron.remove(doc.cronJobName);
    },
  });

  SyncedCron.start();
});

Meteor.methods({
  tp_unicron_addCronJob(options) {
    // timeInterval must be text, e.x. 2 minutes
    tpCronJobs.insert({
      jobName: options.cronJobName,
      interval: options.timeInterval,
      functionName: options.functionName,
      parameters: options.params,
    });
  },
  pauseCronJobs() {
    SyncedCron.pause();
  },
  unpauseCronJobs() {
    SyncedCron.start();
  },
});

function addJob(options) {
  SyncedCron.add({
    name: options.cronJobName,
    schedule: function(parser) {
      return parser.text(options.timeInterval);
    },
    job: function() {
      Meteor.call(options.functionName, options.parameters);
    },
  });
}<commit_msg>Renamed other methods<commit_after>tpCronJobs = new Mongo.Collection('tp_cronJobs');

Meteor.startup(() => {
  tpCronJobs.find().observe({
    added: function(doc) {
      addJob(doc);
    },
    removed: function(doc) {
      SyncedCron.remove(doc.cronJobName);
    },
  });

  SyncedCron.start();
});

Meteor.methods({
  tp_unicron_addCronJob(options) {
    // timeInterval must be text, e.x. 2 minutes
    tpCronJobs.insert({
      jobName: options.cronJobName,
      interval: options.timeInterval,
      functionName: options.functionName,
      parameters: options.params,
    });
  },
  tp_unicron_pauseCronJobs() {
    SyncedCron.pause();
  },
  tp_unicron_unpauseCronJobs() {
    SyncedCron.start();
  },
});

function addJob(options) {
  SyncedCron.add({
    name: options.cronJobName,
    schedule: function(parser) {
      return parser.text(options.timeInterval);
    },
    job: function() {
      Meteor.call(options.functionName, options.parameters);
    },
  });
}
{'fraction_non_alphanumeric': 0.14699792960662525, 'fraction_numerical': 0.0010351966873706005, 'mean_word_length': 3.2297592997811817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2863075', 'n_tokens_mistral': 689, 'n_tokens_neox': 680, 'n_words': 96}