-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathstop-and-start.js
More file actions
55 lines (43 loc) · 1.22 KB
/
stop-and-start.js
File metadata and controls
55 lines (43 loc) · 1.22 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const crypto = require('crypto');
const assert = require('assert');
const Sentry = require('@sentry/node-core');
const { setupOtel } = require('../../utils/setupOtel.js');
setTimeout(() => {
process.exit();
}, 20000);
const anr = Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 });
const client = Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
debug: true,
integrations: [anr],
});
setupOtel(client);
Sentry.setUser({ email: 'person@home.com' });
Sentry.addBreadcrumb({ message: 'important message!' });
function longWorkIgnored() {
for (let i = 0; i < 50; 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 < 50; 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);