-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
37 lines (33 loc) · 1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
const activity = require('./lib/activity.service'),
similarity = require('./lib/similarity.service'),
recommendation = require('./lib/recommendation.service'),
model = require('./lib/model.service');
const run = () => {
return activity.recalculateUserItemWeights()
.then(similarity.recalculateUserSimilarities)
.then(recommendation.recalculateUserRecommendations);
};
/**
* Updates the concurrency level for each of the underlying parallel tasks.
* @param {number} newConcurrency - the new concurrency that will be used across the library's calculations
*/
const setConcurrency = (newConcurrency) => {
return new Promise((resolve, reject) => {
activity.setConcurrency(newConcurrency);
similarity.setConcurrency(newConcurrency);
recommendation.setConcurrency(newConcurrency);
resolve();
});
};
/**
* Public API
*/
module.exports = {
activity,
model,
recommendation,
run,
setConcurrency,
similarity
};