Skip to content

Share schedule spread offset - #13172

Merged
abnegate merged 1 commit into
mainfrom
refactor/schedule-spread-base
Aug 10, 2026
Merged

abnegate merged 1 commit into
mainfrom
refactor/schedule-spread-base

Conversation

@abnegate

Copy link
Copy Markdown
Member

Summary

  • moves the deterministic schedule spread offset from ScheduleFunctions to ScheduleBase
  • keeps function scheduling behavior and inherited API compatibility unchanged
  • moves the generic offset coverage to ScheduleBaseTest

Why

Backup scheduling now uses the same deterministic staggering behavior. The common base class is the smallest shared owner and avoids coupling other schedulers to ScheduleFunctions.

Validation

  • focused scheduler tests: 5 tests, 607 assertions
  • Pint lint on all touched files
  • PHPStan: 1,707 files, no errors
  • Rector dry run: 375 files, passed
  • git diff --check

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR moves the deterministic scheduling spread-offset helper from ScheduleFunctions into the shared ScheduleBase without changing function scheduling behavior.

  • Makes deterministic staggering available to other schedulers, including backup scheduling.
  • Moves generic offset coverage into a new ScheduleBaseTest.
  • Retains function-specific spread-window tests in ScheduleFunctionsTest.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The helper implementation is unchanged, the function scheduler continues to resolve it through inheritance, and the moved tests preserve coverage of its generic contract.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Tasks/ScheduleBase.php Adds the unchanged deterministic offset helper to the common scheduler base class with no identified behavioral regression.
src/Appwrite/Platform/Tasks/ScheduleFunctions.php Removes the local helper while preserving the existing inherited call path, spread-window behavior, and telemetry alignment.
tests/unit/Platform/Tasks/ScheduleBaseTest.php Adds generic coverage for determinism, bounds, disabled windows, and dispersion; test-only MD5 values are non-security fixture identifiers.
tests/unit/Platform/Tasks/ScheduleFunctionsTest.php Removes generic helper tests while retaining function-specific spread-window coverage.

Reviews (1): Last reviewed commit: "(refactor): share schedule spread offset" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → refactor/schedule-spread-base (after).

Metric Before After Change
🚀 Requests/sec 296.48 292.87 ⚪ -1.2%
⏱️ Latency P50 50.73 ms 51.5 ms ⚪ +1.5%
⏱️ Latency P95 161.85 ms 161.69 ms ⚪ -0.1%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 51.5 161.69 18,354 292.87 -0.16
Account 85.68 194.67 966 16.08 -1.81
TablesDB 48.95 152.39 9,982 161.38 -0.35
Storage 46.73 150.03 4,830 79.43 -1.67
Functions 73.52 194.36 2,576 42.82 -2.56

Top API waits (after)

API request Max wait (ms)
tablesdb.rows.decrement 641.3
tablesdb.rows.increment 555.39
tablesdb.rows.update 511.06
functions.variables.create 491.19
storage.buckets.create 416.92

@abnegate
abnegate merged commit 0b2f62d into main Aug 10, 2026
43 checks passed
@abnegate
abnegate deleted the refactor/schedule-spread-base branch August 10, 2026 11:33
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