-
Notifications
You must be signed in to change notification settings - Fork 141
Enable Worker heartbeating, plumb plugin names to core, update Core to 45b1d7e #1818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1557d50 to
de87933
Compare
chris-olszewski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only required change is fixing up tests. Rest are light suggestions or questions.
packages/core-bridge/src/worker.rs
Outdated
| } | ||
| } | ||
| CompleteWfError::WorkflowNotEnabled => { | ||
| BridgeError::UnexpectedError(format!("{err}")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinions on this 🤷
| BridgeError::UnexpectedError(format!("{err}")) | |
| BridgeError::UnexpectedError(err.to_string()) |
| .into_iter() | ||
| .map(|name| PluginInfo { | ||
| name, | ||
| version: String::new(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my own knowledge, is version from the past or not yet implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I don't know. haha. The API was originally implemented with version, but not sure what the intent was. Will follow up on this.
| taskTypes: { | ||
| enableWorkflows, | ||
| enableLocalActivities, | ||
| enableRemoteActivities: opts.enableNonLocalActivities && opts.activities.size > 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's basically saying:
enableRemoteActivities: (enableWorkflows && opts.activities.size > 0) && opts.activities.size > 0
Which is incorrect. We don't need workflows to enable remote activities. I'm surprised tests passed with this.
| telemetryOptions?: TelemetryOptions; | ||
|
|
||
| /** | ||
| * Interval for worker heartbeats. `null` disables heartbeating. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not totally comfortable using null as a user-facing marker to disable heartbeating. We do that internally at the bridge layer, to work around limitations of Node/NAPI/Neon, but I don't think we should do that in public APIs.
Instead, I suggest making this Duration | boolean, so false disables heartbeating, true or == null (which includes undefined) defaults to 60s, and anything else is parsed as a Duration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh ok, let's do 0 to disable heartbeating. This is what I was planning on doing in dotnet
What was changed
WorkerTaskTypesbased on if workflows/activities/nexus handlers are registered to the workersdk-coreto45b1d7eWhy?
New feature!
Checklist
Closes [Feature Request] Enable Worker Heartbeating #1810
How was this tested:
Manually tested that heartbeats with a simple plugin from the worker and client both show up in plugins section of the worker heartbeat.
Also tested setting
workerHeartbeatInterval: nulldisables heartbeating for the workerNote
Plumbs worker heartbeat interval into Core, replaces worker activity enablement with explicit task-type flags, and forwards plugin names to Core; updates native/worker APIs and tests accordingly.
worker_heartbeat_interval_millistoconfig::RuntimeOptions; pass toRuntimeOptionsBuilder.heartbeat_interval(...).runtime_newto accept and forward heartbeat interval; rename TS binding tonewRuntime(runtimeOptions).WorkflowNotEnabled/ActivityNotEnabledtoUnexpectedError.native.RuntimeOptionsgainsworkerHeartbeatIntervalMillisand is passed vianewRuntime.WorkerOptionsnow usestaskTypes(enableWorkflows,enableLocalActivities,enableRemoteActivities,enableNexus) and addsplugins: string[].RuntimeOptions.workerHeartbeatInterval(ms or string); compiled toworkerHeartbeatIntervalMillis(0 => disabled).taskTypesbased on registered workflows/activities/nexus;enableRemoteActivitiesrespectsenableNonLocalActivities.PluginInfo.newRuntimeandworkerHeartbeatIntervalMillis.enableNonLocalActivitiesusage withtaskTypesin bridge tests; add test ensuring local activities run when non-local activities are disabled.Written by Cursor Bugbot for commit 3eb05da. This will update automatically on new commits. Configure here.