Skip to content

Commit 156f67b

Browse files
committed
Better thread names
1 parent aa69600 commit 156f67b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

dev-packages/node-integration-tests/suites/thread-blocked-native/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const ANR_EVENT = {
5454
values: [
5555
{
5656
id: '0',
57-
name: '0',
57+
name: 'main',
5858
crashed: true,
5959
current: true,
6060
main: true,
@@ -163,7 +163,7 @@ describe('Thread Blocked Native', { timeout: 30_000 }, () => {
163163
values: [
164164
{
165165
id: '0',
166-
name: '0',
166+
name: 'main',
167167
crashed: false,
168168
current: true,
169169
main: true,
@@ -173,7 +173,7 @@ describe('Thread Blocked Native', { timeout: 30_000 }, () => {
173173
},
174174
{
175175
id: '2',
176-
name: '2',
176+
name: 'worker-2',
177177
crashed: true,
178178
current: true,
179179
main: false,

packages/node-native/src/thread-blocked-watchdog.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,13 @@ function getExceptionAndThreads(
173173
values: Object.entries(threads).map(([threadId, threadState]) => {
174174
const crashed = threadId === crashedThreadId;
175175

176-
const thread: Thread = { id: threadId, name: threadId, crashed, current: true, main: threadId === '0' };
176+
const thread: Thread = {
177+
id: threadId,
178+
name: threadId === '0' ? 'main' : `worker-${threadId}`,
179+
crashed,
180+
current: true,
181+
main: threadId === '0',
182+
};
177183

178184
if (!crashed) {
179185
thread.stacktrace = { frames: prepareStackFrames(threadState.frames) };

0 commit comments

Comments
 (0)