ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Drop the retired workflow-schedules job
Juan Denis0bcdb229d767
diff --git a/backend/app/jobs/builtin_handlers.py b/backend/app/jobs/builtin_handlers.pyindex 4082d071..973ce7b0 100644--- a/backend/app/jobs/builtin_handlers.py+++ b/backend/app/jobs/builtin_handlers.py@@ -61,19 +61,6 @@ def check_auto_sync_schedules():logger.error(f'Auto-sync check failed for site {site.id}: {e}')-def check_workflow_schedules():- """Retired no-op (plan 45 Phase 4).-- The React-Flow Workflow Builder and its execution engine were removed in- favour of the Automations extension (tramo), whose own in-process scheduler- drives ``cron-trigger`` nodes inside the managed engine. The legacy- ``workflows`` tables are kept for read-only export, so this scheduled handler- is retained as a no-op (avoids an orphaned-handler error for any persisted- ``workflow-schedules`` schedule row) but no longer executes anything.- """- return--# How often the per-site WordPress health poller runs (seconds).HEALTH_CHECK_INTERVAL = 300# Retention for recorded health-check samples (days) — bounds unbounded growth@@ -586,7 +573,6 @@ _BUILTINS = [('builtin.auto_sync', check_auto_sync_schedules, 'auto-sync', 60, 60),('builtin.snapshot_retention', run_snapshot_retention, 'snapshot-retention', 3600, 120),('builtin.restore_point_retention', run_restore_point_retention, 'restore-point-retention', 3600, 180),- ('builtin.workflow_schedules', check_workflow_schedules, 'workflow-schedules', 60, 60),('builtin.health_check', run_health_checks, 'health-check', 300, 30),# 30s tick, not the monitor interval: the sweep only polls monitors whose own# interval has elapsed, so this bounds how late a 30s check can fire.diff --git a/backend/migrations/versions/110_drop_workflow_schedules_job.py b/backend/migrations/versions/110_drop_workflow_schedules_job.pynew file mode 100644index 00000000..66267ea4--- /dev/null+++ b/backend/migrations/versions/110_drop_workflow_schedules_job.py@@ -0,0 +1,31 @@+"""Drop the retired workflow-schedules periodic job.++Its handler became a no-op when the workflow engine was retired, yet the+schedule kept firing every 60 seconds — about 1,440 empty job rows a day.+The handler is gone, so the row goes too; any job still queued for it is+cancelled rather than failing with "no handler registered".+"""+import sqlalchemy as sa+from alembic import op++revision = '110_drop_workflow_schedules_job'+down_revision = '109_randomize_legacy_auth_version'+branch_labels = None+depends_on = None++KIND = 'builtin.workflow_schedules'+++def upgrade():+ bind = op.get_bind()+ scheduled = sa.table('scheduled_jobs', sa.column('name', sa.String))+ jobs = sa.table('jobs', sa.column('kind', sa.String), sa.column('status', sa.String))+ bind.execute(scheduled.delete().where(scheduled.c.name == 'workflow-schedules'))+ bind.execute(jobs.update()+ .where(jobs.c.kind == KIND, jobs.c.status == 'pending')+ .values(status='cancelled'))+++def downgrade():+ # Nothing to restore: the handler no longer exists.+ passdiff --git a/backend/tests/test_jobs.py b/backend/tests/test_jobs.pyindex 0d04a910..e18a7154 100644--- a/backend/tests/test_jobs.py+++ b/backend/tests/test_jobs.py@@ -198,7 +198,7 @@ class TestBuiltins:assert 'builtin.crash_loop' in kinds# Warm standby slots are stopped once their time is up (plan 87 §B).assert 'builtin.slot_standby' in kinds- assert len([k for k in kinds if k.startswith('builtin.')]) == 21+ assert len([k for k in kinds if k.startswith('builtin.')]) == 20builtin_handlers.seed_builtin_schedules()# 21 builtin.* schedules (incl. the request-metrics, crash-loop and slot-standby ticks, restore-point/job/telemetry retention,@@ -206,10 +206,10 @@ class TestBuiltins:# fleet threshold check) + login-link/SSO reapers + drift/FIM/bandwidth# sweeps + the host doctor sweep AND the fleet doctor sweep (plan 26)# + the setup-health nag (plan 22).- assert ScheduledJob.query.count() == 29+ assert ScheduledJob.query.count() == 28# Seeding twice doesn't duplicate.builtin_handlers.seed_builtin_schedules()- assert ScheduledJob.query.count() == 29+ assert ScheduledJob.query.count() == 28class TestApi:diff --git a/backend/tests/test_migration_110_workflow_schedules.py b/backend/tests/test_migration_110_workflow_schedules.pynew file mode 100644index 00000000..c2e55118--- /dev/null+++ b/backend/tests/test_migration_110_workflow_schedules.py@@ -0,0 +1,43 @@+"""110 removes the retired no-op schedule and cancels its queued jobs,+leaving every other schedule and job alone."""+import importlib.util+from pathlib import Path++import sqlalchemy as sa+from alembic.migration import MigrationContext+from alembic.operations import Operations+++def _load():+ path = Path(__file__).parents[1] / 'migrations/versions/110_drop_workflow_schedules_job.py'+ spec = importlib.util.spec_from_file_location('m110', path)+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ return module+++def test_retired_schedule_goes_and_queued_jobs_are_cancelled(tmp_path, monkeypatch):+ migration = _load()+ engine = sa.create_engine('sqlite:///' + (tmp_path / 'upgraded.db').as_posix())+ with engine.begin() as conn:+ conn.exec_driver_sql('CREATE TABLE scheduled_jobs (id INTEGER PRIMARY KEY, name TEXT)')+ conn.exec_driver_sql('CREATE TABLE jobs (id INTEGER PRIMARY KEY, kind TEXT, status TEXT)')+ conn.exec_driver_sql("INSERT INTO scheduled_jobs VALUES (1, 'workflow-schedules'), "+ "(2, 'auto-sync')")+ conn.exec_driver_sql("INSERT INTO jobs VALUES "+ "(1, 'builtin.workflow_schedules', 'pending'), "+ "(2, 'builtin.workflow_schedules', 'succeeded'), "+ "(3, 'builtin.auto_sync', 'pending')")+ monkeypatch.setattr(migration, 'op', Operations(MigrationContext.configure(conn)))+ migration.upgrade()+ names = [r[0] for r in conn.exec_driver_sql('SELECT name FROM scheduled_jobs')]+ statuses = dict(conn.exec_driver_sql('SELECT id, status FROM jobs').all())+ engine.dispose()++ assert names == ['auto-sync']+ assert statuses == {1: 'cancelled', 2: 'succeeded', 3: 'pending'}+++def test_handler_and_seed_are_gone():+ from app.jobs.builtin_handlers import _BUILTINS+ assert 'workflow-schedules' not in [name for _k, _f, name, _i, _d in _BUILTINS]