Skip to content

Commit d24aa63

Browse files
committed
remove setintervals
1 parent c4883dd commit d24aa63

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

caching/cachePopularUploads.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ async function getPopularUploads(){
2424

2525
if(logCaching == 'true'){
2626
c.l('Beginning caching popular uploads, getting popular uploads from db');
27+
console.log(moment(new Date).format('hh:mm:ss A'))
2728
}
2829

2930
// TODO: have to have a job to update upload's view amounts

caching/cacheRecentUploads.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const _ = require('lodash');
33
const View = require('../models/index').View;
44
const Upload = require('../models/index').Upload;
55
const categories = require('../config/categories');
6+
const moment = require('moment');
67

78
const javascriptTimeAgo = require('javascript-time-ago');
89
javascriptTimeAgo.locale(require('javascript-time-ago/locales/en'));
@@ -23,6 +24,7 @@ async function getRecentUploads(){
2324

2425
if(logCaching == 'true'){
2526
console.log(`Beginning running recent uploads`);
27+
2628
}
2729

2830
let recentUploadsAllCategories = [];
@@ -65,6 +67,9 @@ async function getRecentUploads(){
6567
async function setRecentUploads(){
6668
let recentUploads = await getRecentUploads();
6769

70+
console.log(`Calculating view amounts`);
71+
console.log(moment(new Date).format('hh:mm:ss A'))
72+
6873
// calculate view periods for each upload
6974
recentUploads = await Promise.all(recentUploads.map(async function(upload){
7075

caching/runCaching.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ console.log(`CACHE TOTAL VIEW INTERVAL IN MINUTES: ${cacheIntervalInMinutes} \n`
110110

111111
async function main(){
112112

113-
setInterval(cacheOnlyRecentUploads, cacheRecentIntervalInMs);
114-
115-
setInterval(cachePopularDailyStatsAndIndex, cacheIntervalInMs);
116-
117-
// calculate total amount of views for channel display
118-
// TODO: couldn't this just be done during popular? maybe not because it doesn't do for sensitive?
119-
// TODO: then just do a separate job for
120-
setInterval(calculateUploadViews, cacheTotalViewsIntervalInMs);
113+
// setInterval(cacheOnlyRecentUploads, cacheRecentIntervalInMs);
114+
//
115+
// setInterval(cachePopularDailyStatsAndIndex, cacheIntervalInMs);
116+
//
117+
// // calculate total amount of views for channel display
118+
// // TODO: couldn't this just be done during popular? maybe not because it doesn't do for sensitive?
119+
// // TODO: then just do a separate job for
120+
// setInterval(calculateUploadViews, cacheTotalViewsIntervalInMs);
121121

122122
// calculate and cache recent uploads every minute
123123
await cacheOnlyRecentUploads();

0 commit comments

Comments
 (0)