<commit_before>'use strict';

var Quartz = require('quartz-scheduler');
var uuid = require('uuid');

var name = 'quartz-scheduler';

var scheduler;

module.exports = function(options) {
  var seneca = this;

  seneca.add({role: 'scheduler', cmd: 'register'}, function(args, done) {

    var taskId = uuid.v4();

    scheduler.schedule(taskId, args.when, args.data, function(err, jobId) {
      seneca.log.debug('Scheduled job', taskId);
      done(err);
    });

    scheduler.on(taskId, function(data, callback) {
      seneca.log.debug('Executing job', taskId);
      args.task();
      callback();
    });

  });

  seneca.add({init: name}, function(args, done) {
    scheduler = new Quartz();
    scheduler.start(done);
  });

  return {
    name: name
  }
}<commit_msg>Pass options along to node-quartz-scheduler<commit_after>'use strict';

var Quartz = require('quartz-scheduler');
var uuid = require('uuid');

var name = 'quartz-scheduler';

var scheduler;

module.exports = function(options) {
  var seneca = this;

  seneca.add({role: 'scheduler', cmd: 'register'}, function(args, done) {

    var taskId = uuid.v4();

    scheduler.schedule(taskId, args.when, args.data, function(err, jobId) {
      seneca.log.debug('Scheduled job', taskId);
      done(err);
    });

    scheduler.on(taskId, function(data, callback) {
      seneca.log.debug('Executing job', taskId);
      args.task();
      callback();
    });

  });

  seneca.add({init: name}, function(args, done) {
    scheduler = new Quartz(options);
    scheduler.start(done);
  });

  return {
    name: name
  }
}
{'fraction_non_alphanumeric': 0.1665615141955836, 'fraction_numerical': 0.0012618296529968455, 'mean_word_length': 3.417827298050139, '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': '1628047', 'n_tokens_mistral': 554, 'n_tokens_neox': 533, 'n_words': 114}