-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathstop-and-start.js
52 lines (41 loc) · 1.12 KB
/
stop-and-start.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const crypto = require('crypto');
const assert = require('assert');
const Sentry = require('@sentry/node');
setTimeout(() => {
process.exit();
}, 10000);
const anr = Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 });
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
debug: true,
integrations: [anr],
});
Sentry.setUser({ email: '[email protected]' });
Sentry.addBreadcrumb({ message: 'important message!' });
function longWorkIgnored() {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
assert.ok(hash);
}
}
function longWork() {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
assert.ok(hash);
}
}
setTimeout(() => {
anr.stopWorker();
setTimeout(() => {
longWorkIgnored();
setTimeout(() => {
anr.startWorker();
setTimeout(() => {
longWork();
});
}, 2000);
}, 2000);
}, 2000);