使用percolate:synced-cron软件包,我正在尝试安排在将来的特定时间发送电子邮件。我将未来的任务插入到数据库中,但是我收到此错误Exception in setTimeout callback: TypeError: Cannot call method 'getTime' of undefined
db.future_tasks.find({}).pretty()
{
"_id" : "t35s5Daj7iwNeW9gm",
"to" : "niko.tzikas@gmail.com",
"from" : "niko.tzikas@gmail.com",
"subject" : "wassup",
"text" : ISODate("2015-07-22T19:25:32.781Z"),
"date" : ISODate("2015-07-22T19:25:32.781Z")
}
I20150722-15:22:50.339(-4) (synced-cron-server.js:52) SyncedCron: scheduled "EguDR6bFxKNECZAXF" next run @Wed Jul 22 2015 15:23:10 GMT-0400 (EDT)
I20150722-15:23:10.266(-4) (synced-cron-server.js:52) SyncedCron: Starting "EguDR6bFxKNECZAXF".
I20150722-15:23:10.269(-4) (synced-cron-server.js:52) SyncedCron: Removed "EguDR6bFxKNECZAXF
I20150722-15:23:10.271(-4) (synced-cron-server.js:52) SyncedCron: Finished "EguDR6bFxKNECZAXF".
I20150722-15:23:10.279(-4)? Exception in setTimeout callback: TypeError: Cannot call method 'getTime' of undefined
I20150722-15:23:10.279(-4)? at scheduleTimeout (packages/percolatestudio:synced-cron/synced-cron-server.js:238:1)
I20150722-15:23:10.280(-4)? at Object.SyncedCron._laterSetTimeout (packages/percolatestudio:synced-cron/synced-cron-server.js:228:1)
I20150722-15:23:10.280(-4)? at scheduleTimeout (packages/percolatestudio:synced-cron/synced-cron-server.js:206:1)
I20150722-15:23:10.280(-4)? at packages/percolatestudio:synced-cron/synced-cron-server.js:248:1
I20150722-15:23:10.280(-4)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20150722-15:23:10.281(-4)? at packages/meteor/timers.js:6:1
I20150722-15:23:10.281(-4)? at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
我尝试将日期作为字符串,但没有区别。如果我真的尝试通过电子邮件发送任务(没有SyncedChron),如:
Email.send({
from: details.from,
to: details.to,
subject:new Date(),
text: details.date
//date: details.date
});
我明白了:
TypeError: Object Wed Jul 22 2015 15:24:46 GMT-0400 (EDT) has no method 'replace'
http://richsilv.github.io/meteor/scheduling-events-in-the-future-with-meteor/