Skip to content

Commit 536a30b

Browse files
committed
Build fixes
1 parent 936d588 commit 536a30b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Stack traces show where each thread is currently executing:
107107

108108
Set up automatic detection of blocked event loops:
109109

110-
### 1. Set up thread heartbeats
110+
### 1. Register threads with `AsyncLocalStorage` state tracking and heartbeats
111111

112112
Send regular heartbeats:
113113

@@ -194,7 +194,9 @@ but will not capture the stack trace of the calling thread itself.
194194
```ts
195195
type Thread<A = unknown, P = unknown> = {
196196
frames: StackFrame[];
197+
/** State captured from the AsyncLocalStorage */
197198
asyncState?: A;
199+
/** Optional state provided when calling threadPoll */
198200
pollState?: P;
199201
};
200202

module.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <mutex>
44
#include <node.h>
55
#include <node_version.h>
6+
#include <optional>
67

78
// Platform-specific includes for time functions
89
#ifdef _WIN32
@@ -365,10 +366,8 @@ void RegisterThreadInternal(
365366
std::lock_guard<std::mutex> lock(threads_mutex);
366367
auto found = threads.find(isolate);
367368
if (found == threads.end()) {
368-
threads.emplace(isolate,
369-
ThreadInfo{thread_name, .last_seen = milliseconds::zero(),
370-
.async_store = std::move(async_store),
371-
.poll_state = ""});
369+
threads.emplace(isolate, ThreadInfo{thread_name, milliseconds::zero(),
370+
std::move(async_store), ""});
372371
// Register a cleanup hook to remove this thread when the isolate is
373372
// destroyed
374373
node::AddEnvironmentCleanupHook(isolate, Cleanup, isolate);

test/stalled.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { Worker, threadId } = require('node:worker_threads');
1+
const { Worker } = require('node:worker_threads');
22
const { longWork } = require('./long-work.js');
33
const { registerThread, threadPoll } = require('@sentry-internal/node-native-stacktrace');
44

0 commit comments

Comments
 (0)