Skip to content

fix(rivetkit-core): enumerate non-drained counters in grace deadline warn log#4746

Merged
NathanFlurry merged 1 commit intomainfrom
sleep-cleanup/05-grace-deadline-counter-log
Apr 27, 2026
Merged

fix(rivetkit-core): enumerate non-drained counters in grace deadline warn log#4746
NathanFlurry merged 1 commit intomainfrom
sleep-cleanup/05-grace-deadline-counter-log

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 24, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown

claude Bot commented Apr 24, 2026

PR Review: fix(rivetkit-core): enumerate non-drained counters in grace deadline warn log

This is a clean, well-scoped observability improvement. The grace-deadline warning log now includes all the activity counters that feed into can_finalize_sleep, making it directly actionable when diagnosing a stalled shutdown.

What changed

  • sleep.rs: websocket_callback_count and active_http_request_count promoted to pub(crate); #[cfg(test)] + #[allow(dead_code)] removed from core_dispatched_hook_count since it is now used in production code.
  • task.rs: on_sleep_grace_deadline warning log extended with actor_id, all sleep-drain counters, and connection_count.

Looks good

  • Logging conventions followed: structured fields, lowercase message, no string interpolation, no eprintln!/println!. actor_id uses % (Display) consistent with the rest of the file.
  • Counter set is complete: the fields added exactly mirror the inputs to can_finalize_sleep/can_sleep, so the log is self-contained for diagnosing a drain stall.
  • Attribute cleanup is correct: core_dispatched_hook_count is now called in production code, so removing #[cfg(test)] and #[allow(dead_code)] is the right call.
  • Visibility scope is minimal: methods are pub(crate), not pub.
  • No new concurrency, error handling, or security surface introduced.

Minor note

connection_count = self.ctx.conns().len() briefly acquires a read lock at log time. Fine here — this is a diagnostic read on an already-degraded shutdown path.

The PR description template was left unfilled, but the code itself is correct and follows all conventions. No blocking issues.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

Preview packages published to npm

Install with:

npm install rivetkit@pr-4746

All packages published as 0.0.0-pr.4746.8654fe3 with tag pr-4746.

Engine binary is shipped via @rivetkit/engine-cli on linux-x64-musl, linux-arm64-musl, darwin-x64, and darwin-arm64. Windows users should use the release installer or set RIVET_ENGINE_BINARY.

Docker images:

docker pull rivetdev/engine:slim-8654fe3
docker pull rivetdev/engine:full-8654fe3
Individual packages
npm install rivetkit@pr-4746
npm install @rivetkit/react@pr-4746
npm install @rivetkit/rivetkit-napi@pr-4746
npm install @rivetkit/workflow-engine@pr-4746

Base automatically changed from sleep-cleanup/04-abort-graceful-cleanup-at-deadline to main April 27, 2026 07:13
@NathanFlurry NathanFlurry merged commit 460cb0e into main Apr 27, 2026
35 of 42 checks passed
@NathanFlurry NathanFlurry deleted the sleep-cleanup/05-grace-deadline-counter-log branch April 27, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant