• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const total = parseInt(process.env.TEST_ALLOCATION) || 5000;
4const chunk = parseInt(process.env.TEST_CHUNK) || 1000;
5const cleanInterval = parseInt(process.env.TEST_CLEAN_INTERVAL) || 100;
6let count = 0;
7let arr = [];
8function runAllocation() {
9  count++;
10  if (count < total) {
11    if (count % cleanInterval === 0) {
12      arr.splice(0, arr.length);
13      setImmediate(runAllocation);
14    } else {
15      const str = JSON.stringify(process.config).slice(0, chunk);
16      arr.push(str);
17      setImmediate(runAllocation);
18    }
19  }
20}
21
22setImmediate(runAllocation);
23