Skip to content

Commit a78408c

Browse files
committed
feat(queue): some clean ups for queue feature
1 parent 2665fa8 commit a78408c

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
var cluster = require('cluster');
33
var config = require('./config');
44
var log = require('./services/logger');
5-
var kue = require('kue');
65
var basicAuth = require('basic-auth-connect');
76
var express = require('express');
87

98
if (cluster.isMaster && config.env === 'production') {
9+
var kue = require('./services/queue').kue;
1010
var app = express();
1111
app.use(basicAuth(config.queueUIUsername, config.queueUIPassword));
1212
app.use(kue.app);

models/RequestLogs.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ schemaObject.developer = {
7878

7979
schemaObject.tags = {
8080
type: [String],
81-
index: 'text',
82-
default:[]
81+
index: 'text'
8382
};
8483

8584
// Let us define our schema
@@ -118,7 +117,6 @@ Schema.pre('save', function(next) {
118117

119118
// Dump it in the queue
120119
queue.create('searchIndex', ourDoc)
121-
.priority('high')
122120
.save();
123121

124122
next();
@@ -177,7 +175,6 @@ Schema.pre('update', function(next) {
177175
}else{
178176
// Dump it in the queue
179177
queue.create('searchIndex', ourDoc)
180-
.priority('high')
181178
.save();
182179
}
183180

models/Trash.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Schema.pre('save', function(next) {
9191

9292
// Dump it in the queue
9393
queue.create('searchIndex', ourDoc)
94-
.priority('high')
9594
.save();
9695

9796
next();
@@ -147,7 +146,6 @@ Schema.pre('update', function(next) {
147146
}else{
148147
// Dump it in the queue
149148
queue.create('searchIndex', ourDoc)
150-
.priority('high')
151149
.save();
152150
}
153151

models/Users.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ Schema.pre('save', function(next) {
8888

8989
// Dump it in the queue
9090
queue.create('searchIndex', ourDoc)
91-
.priority('high')
9291
.save();
9392

9493
next();
@@ -143,7 +142,6 @@ Schema.pre('update', function(next) {
143142
}else{
144143
// Dump it in the queue
145144
queue.create('searchIndex', ourDoc)
146-
.priority('high')
147145
.save();
148146
}
149147

services/queue/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ queue
1515
.on('job complete', function(id, result){
1616
kue.Job.get(id, function(err, job){
1717
if (err) {
18-
throw new Error(err.message);
18+
return false;
1919
}else{
2020
job.remove(function(err){
2121
if (err) {
@@ -55,3 +55,4 @@ queue.watchStuckJobs(1000);
5555

5656
// Process Jobs Here
5757
module.exports = queue;
58+
module.exports.kue = kue;

services/queue/jobs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs.updateRequestLog = function(response, done){
3636

3737
// Creates search tags for all db records
3838
jobs.createSearchTags = function(data, done){
39-
var model = data.model;
40-
var update = data.update ? true : false;
41-
if(data.update){
39+
var model = data.model;
40+
var update = data.update ? true : false;
41+
if(data.update){
4242
delete data.update;
4343
}
4444
delete data.model;

0 commit comments

Comments
 (0)