Permalink
Browse files

Changed some implicit global variables to local variables.

  • Loading branch information...
1 parent 9dbf479 commit ac2a93ffe108d6c3bb1978191f9388da15dd98f4 @coderunr coderunr committed Jan 12, 2013
Showing with 7 additions and 7 deletions.
  1. +3 −3 fixtures/computeStats.js
  2. +1 −1 models/checkEvent.js
  3. +2 −2 models/migrations/upgrade2to3.js
  4. +1 −1 models/ping.js
View
@@ -29,7 +29,7 @@ var updateHourlyQosSinceTheFirstPing = function(callback) {
.findOne(function(err, ping) {
var date = Date.now() + 60 * 60 * 1000;
var oldestDate = ping.timestamp.valueOf();
- nbDates = 0;
+ var nbDates = 0;
async.whilst(
function() { date -= 60 * 60 * 1000; return date > oldestDate; },
function(cb) {
@@ -71,7 +71,7 @@ var updateMonthlyQosSinceTheFirstPing = function(callback) {
.findOne(function(err, ping) {
var date = Date.now() + 28 * 24 * 60 * 60 * 1000;
var oldestDate = ping.timestamp.valueOf();
- nbDates = 0;
+ var nbDates = 0;
async.whilst(
function() { date -= 28 * 24 * 60 * 60 * 1000; return date > oldestDate; },
function(cb) {
@@ -92,7 +92,7 @@ var updateYearlyQosSinceTheFirstPing = function(callback) {
.findOne(function(err, ping) {
var date = Date.now() + 365 * 24 * 60 * 60 * 1000;
var oldestDate = ping.timestamp.valueOf();
- nbDates = 0;
+ var nbDates = 0;
async.whilst(
function() { date -= 365 * 24 * 60 * 60 * 1000; return date > oldestDate; },
function(cb) {
View
@@ -59,7 +59,7 @@ CheckEvent.statics.aggregateEventsByDay = function(events, callback) {
};
CheckEvent.statics.cleanup = function(maxAge, callback) {
- oldestDateToKeep = new Date(Date.now() - (maxAge || 3 * 31 * 24 * 60 * 60 * 1000));
+ var oldestDateToKeep = new Date(Date.now() - (maxAge || 3 * 31 * 24 * 60 * 60 * 1000));
this.find({ timestamp: { $lt: oldestDateToKeep } }).remove(callback);
};
@@ -85,7 +85,7 @@ var getOldestDate = function(callback) {
var updateMonthlyQos = function(start, callback) {
var date = Date.now() + 28 * 24 * 60 * 60 * 1000;
- nbDates = 0;
+ var nbDates = 0;
async.whilst(
function() { date -= 28 * 24 * 60 * 60 * 1000; return date > start; },
function(cb) {
@@ -100,7 +100,7 @@ var updateMonthlyQos = function(start, callback) {
var updateYearlyQos = function(start, callback) {
var date = Date.now() + 365 * 24 * 60 * 60 * 1000;
- nbDates = 0;
+ var nbDates = 0;
async.whilst(
function() { date -= 365 * 24 * 60 * 60 * 1000; return date > start; },
function(cb) {
View
@@ -50,7 +50,7 @@ Ping.statics.createForCheck = function(status, timestamp, time, check, monitorNa
};
Ping.statics.cleanup = function(maxAge, callback) {
- oldestDateToKeep = new Date(Date.now() - (maxAge || 3 * 31 * 24 * 60 * 60 * 1000));
+ var oldestDateToKeep = new Date(Date.now() - (maxAge || 3 * 31 * 24 * 60 * 60 * 1000));
this.find({ timestamp: { $lt: new Date(oldestDateToKeep) } }).remove(callback);
};

0 comments on commit ac2a93f

Please sign in to comment.