- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
RESOLVED:
要解决此问题,需要更改以下答案,但请注意,如果使用 nodemon/grunt-nodemon 存在另一个问题,其中 1.2.x 出于某种原因使控制台输出静音,因此如果使用控制台进行测试,它将无法正常工作. 1.3.x 已修复、更新并解决任何依赖性问题。我最终将下面的固定代码移到了我的 app = express() 行下。并将任何 agenda-ui 行与我的其余 app.use() 中间件放在一起。
此外,如果使用 agenda-ui,则会引入一些中断,在尝试访问/agenda-ui 端点时会返回“无法读取未定义的属性”。还不知道为什么,但有一个开放的错误报告。
ORIGINAL POST
我知道我是这里的问题。我已经构建了一个应用程序并想使用“议程”进行后端作业调度。应用程序在 server.js 中没有议程行时工作正常。它直接在议程的 github 页面上说没有推荐的布局,因此尝试通过在我的 server.js 中插入它来测试基本功能一开始似乎是可行的。
Nodemon 启动并立即因错误而崩溃,但没有关于原因的痕迹或信息。启动:
[nodemon] v1.2.1 [nodemon] to restart at any time, enter
rs
[nodemon] watching: app/views//. gruntfile.js server.js config//*.js app/**/*.js
[nodemon] startingnode --debug server.js
[nodemon] app crashed - waiting for file changes before starting...
我把议程代码放在最后我会说在一些基本测试之后应用程序不会崩溃直到这两行被取消注释。我认为这可能与我的连接字符串有关,因为这是我已经连接到主应用程序的数据库的名称。但我又一次用完了可供借鉴的信息。
agenda.schedule('in 10 seconds', 'greet the world', {time: new Date()});
agenda.start();
'use strict';
/**
* Module dependencies.
*/
var init = require('./config/init')(),
config = require('./config/config'),
mongoose = require('mongoose'),
chalk = require('chalk'),
Agenda = require('agenda');
/**
* Main application entry file.
* Please note that the order of loading is important.
*/
// Bootstrap db connection
var db = mongoose.connect(config.db, function(err) {
if (err) {
console.error(chalk.red('Could not connect to MongoDB!'));
console.log(chalk.red(err));
}
});
// Init the express application
var app = require('./config/express')(db);
// Bootstrap passport config
require('./config/passport')();
// Start the app by listening on <port>
app.listen(config.port);
// Expose app
exports = module.exports = app;
// Logging initialization
console.log('Application started on port ' + config.port);
/////--------TESTING----------------
var agenda = new Agenda({
db: {
address: 'mongodb://localhost/consultations',
collection: 'emailQueue'
//options: {
// ssl: true
//}
}
});
agenda.define('greet the world', function(job, done) {
console.log(job.attrs.data.time, 'hello world!');
done();
});
agenda.schedule('in 10 seconds', 'greet the world', {time: new Date()});
agenda.start();
console.log('Wait 10 seconds...');
//////------------------------
最佳答案
试试这个
agenda.on('ready', function() {
agenda.define('greet the world', function(job, done) {
console.log(job.attrs.data.time, 'hello world!');
done();
});
agenda.schedule('in 10 seconds', 'greet the world', {
time: new Date()
});
agenda.start();
});
我也有类似的数据库
var agenda = new Agenda({
db: {
address: 'localhost:27017/test' //default collection agendaJobs
}
});
希望对您有所帮助
关于javascript - 使用 'agenda' 时,Nodemon 在启动时崩溃且无踪迹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33810898/
我正在制作一个应用程序,当您按下一个表示紧急的按钮时,会有一个标签显示“紧急”。就在我实现与按钮的用户交互之前,我有一个数组(如下所示),其中一些对象具有 urgent = true,但有些对象具有
我正在使用Agenda在我的服务器上运行计划事件。 我正在使用以下代码安排作业: var job = global.agenda.create('send happy hour notificatio
有人知道为什么我的议程 View 看起来像这样吗?我正在使用 org-agenda 运行 spacemacs,使用很多这样的习惯: **** TODO Consume a tablespoon of
我有一个目录 tasks/在 org-agenda-files多变的。当我向 org-agenda-files 添加文件时通过 C-c [ 命令 ( org-agenda-file-to-front
我对此感到很困惑,搜索了文档,但仍然找不到答案,所以这里是:我经常注意到我的议程 View 的缓冲区名称会被装饰成类似的东西: *Org Agenda(a:2013-10-31---2013-10-3
我在freenode上的#org-mode组中找到了答案 我对org-agenda-list和org-todo-list函数有问题,它们破坏了我的Windows拆分并将emacs拆分为2个相等的窗口,
如何使用 FullCalendar jQuery 插件禁用议程 View (周、日模式)中的滚动?在月份模式下一切都很好,但是当我更改为周/日模式时,我的主页滚动条旁边有一个滚动条。 最佳答案 这就是
我使用 org-mode 每周/每日议程,并希望能够使用 SCHEDULED 关键字隐藏项目,直到预定时间到来。在那之前我不想考虑他们。如何设置 org-agenda-list 来执行此操作? 这是议
目前,由于 erikstokes,我的全局 TODO 列表如下所示: (org-agenda-prefix-format "%i %?-12(concat\"[\"(org-format-outlin
RESOLVED: 要解决此问题,需要更改以下答案,但请注意,如果使用 nodemon/grunt-nodemon 存在另一个问题,其中 1.2.x 出于某种原因使控制台输出静音,因此如果使用控制台进
我周围有一些人使用农历而不是公历,所以我目前的设置: *** Birthdays :PROPERTIES: :CATEGORY: Birthday :END: **** NAME 未能在正确的时间出
与其他人一样,我在将定时事件显示在 agendaWeek View 中时遇到了问题。如果你看下面的事件,前两个是我的并且显示为全天事件。最后一个来自文档并显示在正确的时间 block 中。我一直盯着这
我正在使用 Agenda.js 和 Node 设置作业调度程序,并以 MongoDB 为后盾。到目前为止,它按预期工作。但是,我不清楚如何安排重复作业——例如,每天上午 9 点运行的作业。 “sche
我这里有个问题。我如何像 Node 调度程序一样使用议程在将来的某个日期时间运行作业。基于https://www.npmjs.com/package/node-schedule , node-sche
我在谷歌上查找,但没有找到相关信息。 我会实现这个小部件 http://mysmarttransport.fr/api_dialog_timer.png 你认为这个 API 是谷歌拥有的还是包含在 A
我的 .emacs 中有以下设置 ... (defvar org-dir "/home/mash/read/org/") 并在...周围使用它 (setq org-directory org-dir)
我开始为我的应用程序使用 React Native 日历。我在其中一个屏幕中使用了议程。然而,在选择日期时有一个奇怪的问题。我已经设置了过去滚动范围和 future 滚动范围。问题是每当我从日历的第一
我管理多个生物信息学项目,每个项目都有一个组织模式文件,其中包含 TODO 项目、 session 记录以及工作流程和数据转换的日志记录。通过自定义 org-agenda-files 收集我的所有文件
我有一个日历,通常是一个包含多行的 csv 文件。每行对应一个个体,是一个连续值“0”和“1”的序列,其中“0”表示空时隙,“1”表示占用时隙。一行中不能有两个分开的序列(例如,两个由 '0' 分隔的
我正在使用来自 http://jfxtras.org/ 的 FXtras(版本 8.0-r5)议程,我在其中定义了两种类型的约会:个人(group1)和共享(group2)。用户可以编辑个人约会的时间
我是一名优秀的程序员,十分优秀!