Skip to content

Commit

Permalink
perf(cache): improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed May 23, 2019
1 parent 1b4d699 commit 9ff2c14
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
8 changes: 3 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ function launchServer (db) {
// return next()
// },
function (next) {
var NodeCache = require('./src/cache/node-cache')
global.cache = new NodeCache({ checkperiod: 0 })
var fork = require('child_process').fork
var memLimit = nconf.get('memlimit') || '2048'

Expand All @@ -219,11 +221,7 @@ function launchServer (db) {

n.on('message', function (data) {
if (data.cache) {
var NodeCache = require('./src/cache/node-cache')
global.cache = new NodeCache({
data: data.cache.data,
checkperiod: 0
})
global.cache.data = data.cache.data
}
})

Expand Down
1 change: 1 addition & 0 deletions src/cache/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ truCache.refreshCache = function (callback) {
}
],
function (err) {
tickets = null
return cb(err)
}
)
Expand Down
4 changes: 0 additions & 4 deletions src/cache/node-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@
}

var hasProp = {}.hasOwnProperty

var slice = [].slice

_ = require('lodash')

clone = require('clone')

EventEmitter = require('events').EventEmitter

module.exports = (function (superClass) {
Expand Down
3 changes: 1 addition & 2 deletions src/elasticsearch/rebuildIndexChild.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ function crawlTickets (callback) {
}

function rebuild (callback) {
setupClient()
async.series(
[
function (next) {
Expand All @@ -363,7 +362,7 @@ function rebuild (callback) {
}
],
function (err) {
if (err) winston.debug(err)
if (err) winston.error(err)

return callback(err)
}
Expand Down

0 comments on commit 9ff2c14

Please sign in to comment.