更改Meteor synced-cron

时间:2016-02-26 08:39:07

标签: meteor crontab

我在Meteor 1.2中使用percolate:synced-cron 我需要改变时区'亚洲/迪拜'。 我试过了

SyncedCron.config({
    utc: false, (true/false both)
    timezone: 'Asia/Dubai'
});

以及

SyncedCron.add({
    name: ....
    timezone: 'Asia/Dubai',
    .........
});

但没有运气。

提前致谢

更新

我找到了另一个fork包,我可以在哪里使用timezone

saucecode:timezoned-synced-cron

1 个答案:

答案 0 :(得分:0)

来自package

中的代码
Meteor.startup(function() {
  var options = SyncedCron.options;

  log = createLogger('SyncedCron');

  ['info', 'warn', 'error', 'debug'].forEach(function(level) {
    log[level] = _.partial(log, level);
  });

  // Don't allow TTL less than 5 minutes so we don't break synchronization
  var minTTL = 300;

  // Use UTC or localtime for evaluating schedules
  if (options.utc)
    Later.date.UTC();
  else
    Later.date.localTime();

  // collection holding the job history records
  SyncedCron._collection = new Mongo.Collection(options.collectionName);
  SyncedCron._collection._ensureIndex({intendedAt: 1, name: 1}, {unique: true});

  if (options.collectionTTL) {
    if (options.collectionTTL > minTTL)
      SyncedCron._collection._ensureIndex({startedAt: 1 },
        { expireAfterSeconds: options.collectionTTL } );
    else
      log.warn('Not going to use a TTL that is shorter than:' + minTTL);
  }
});

您会注意到它使用utc或默认为当地时间。无法指定特定时区。