-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (35 loc) · 1.19 KB
/
Copy pathindex.js
File metadata and controls
38 lines (35 loc) · 1.19 KB
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
38
/**
* TODO add perspectives to setup/teardown
*/
const debug = require('debug')('refocus-load-sim');
const Repeat = require('repeat');
const conf = require('./config/config');
const samples = require('./samples');
const subjects = require('./subjects');
const setup = require('./setup');
const teardown = require('./teardown');
console.log('===============================================================');
console.log(conf);
console.log('===============================================================');
const rh = conf.repeat.hierarchy;
const ru = conf.repeat.upserts;
let rootMap;
setup.doSetup()
.then((res) => (rootMap = res))
.then(() => {
debug('Execute a bunch of hierarchy and bulk upsert requests...')
Repeat(() => samples.upsert(rootMap))
.every(ru.every, ru.everyUnit)
.for(ru.for, ru.forUnit)
.start.in(ru.wait, ru.waitUnit);
return Repeat(() => subjects.hierarchy(Object.keys(rootMap)))
.every(rh.every, rh.everyUnit)
.for(rh.for, rh.forUnit)
.start.now();
})
.then(() =>
debug('Finished executing a bunch of hierarchy and bulk upsert requests'))
.then(() => teardown.doTeardown(rootMap))
.then(() => debug('Done'))
.then(() => Promise.resolve())
.catch(console.err);