Skip to content

Conversation

@jumski
Copy link
Contributor

@jumski jumski commented Dec 4, 2025

Add track_worker_function for edge function monitoring

This PR introduces a new SQL function pgflow.track_worker_function() that allows edge functions to register themselves for monitoring by the ensure_workers() cron job.

The function:

  • Takes a function name as input
  • Inserts or updates a record in the pgflow.worker_functions table
  • Updates the updated_at timestamp on each call

This enables worker functions to "check in" periodically, allowing the system to detect and restart any workers that have stopped responding.

Added comprehensive tests to verify:

  • New worker functions are inserted correctly
  • Default values are set appropriately (enabled=true, heartbeat_timeout=6)
  • Timestamps are updated properly on subsequent calls
  • Multiple different functions can be tracked

Also updated TypeScript database types to include the new function.

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

⚠️ No Changeset found

Latest commit: aedf84f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Dec 4, 2025

View your CI Pipeline Execution ↗ for commit aedf84f

Command Status Duration Result
nx run client:e2e ✅ Succeeded 1m 9s View ↗
nx run edge-worker:test:integration ✅ Succeeded 4m 53s View ↗
nx run cli:e2e ✅ Succeeded 4s View ↗
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 4s View ↗
nx run core:pgtap ✅ Succeeded 1s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 31s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 35s View ↗
nx run edge-worker:e2e ✅ Succeeded 46s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-05 23:08:02 UTC

@jumski jumski force-pushed the 12-04-add_track_worker_function_sql_function_for_worker_registration branch from 179a131 to a6b7275 Compare December 4, 2025 16:54
@jumski jumski changed the base branch from 12-04-add_worker_functions_table_and_stopped_at_column_to_workers to graphite-base/505 December 5, 2025 07:19
@jumski jumski force-pushed the graphite-base/505 branch from b0378fa to 03ec709 Compare December 5, 2025 07:21
@jumski jumski force-pushed the 12-04-add_track_worker_function_sql_function_for_worker_registration branch from a6b7275 to a26dc00 Compare December 5, 2025 07:21
@jumski jumski changed the base branch from graphite-base/505 to 12-04-add_worker_functions_table_and_stopped_at_column_to_workers December 5, 2025 07:21
@jumski jumski force-pushed the 12-04-add_track_worker_function_sql_function_for_worker_registration branch from a26dc00 to bfe384c Compare December 5, 2025 09:24
@jumski jumski force-pushed the 12-04-add_worker_functions_table_and_stopped_at_column_to_workers branch 2 times, most recently from c6ddeaf to be78079 Compare December 5, 2025 10:04
@jumski jumski force-pushed the 12-04-add_track_worker_function_sql_function_for_worker_registration branch from bfe384c to 89d0e0b Compare December 5, 2025 10:04
@jumski jumski force-pushed the 12-04-add_worker_functions_table_and_stopped_at_column_to_workers branch from be78079 to e802d13 Compare December 5, 2025 13:05
@jumski jumski force-pushed the 12-04-add_track_worker_function_sql_function_for_worker_registration branch from 89d0e0b to 5e801eb Compare December 5, 2025 13:05
@jumski jumski force-pushed the 12-04-add_track_worker_function_sql_function_for_worker_registration branch from 5e801eb to aedf84f Compare December 5, 2025 22:53
@jumski jumski force-pushed the 12-04-add_worker_functions_table_and_stopped_at_column_to_workers branch from e802d13 to 4e01611 Compare December 5, 2025 22:53
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

🔍 Preview Deployment: Website

Deployment successful!

🔗 Preview URL: https://pr-505.pgflow.pages.dev

📝 Details:

  • Branch: 12-04-add_track_worker_function_sql_function_for_worker_registration
  • Commit: a98a30cfde76d91e5b908beea07e13fd502a6ae1
  • View Logs

_Last updated: _

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.

2 participants