Skip to content

Fix ScheduleExecutions: inverted comparison prevented execution scheduling#10916

Merged
stnguyen90 merged 3 commits into1.8.xfrom
copilot/fix-schedule-executions-bug
Dec 8, 2025
Merged

Fix ScheduleExecutions: inverted comparison prevented execution scheduling#10916
stnguyen90 merged 3 commits into1.8.xfrom
copilot/fix-schedule-executions-bug

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 7, 2025

What does this PR do?

Fixes inverted comparison logic in ScheduleExecutions.php that prevented scheduled executions from running. The condition was skipping executions that should execute and processing ones scheduled too far in the future.

Change:

// Before: skips executions within the interval (wrong)
if ($scheduledAt <= $intervalEnd) {
    continue;
}

// After: skips executions beyond the interval (correct)
if ($scheduledAt > $intervalEnd) {
    continue;
}

The logic now matches the pattern in ScheduleMessages.php and ScheduleFunctions.php, where scheduledAt > threshold correctly identifies items not yet ready for processing.

Test Plan

  • Verified fix aligns with comparison logic in ScheduleMessages.php:38 and ScheduleFunctions.php:64-66
  • Code review and security scan passed with no issues

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?
Original prompt

On ScheduleExecutions.php, Update src/Appwrite/Platform/Tasks/ScheduleExecutions.php to fix a bug where executions are not being executed despite them being scheduled.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 7, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Fix bug in scheduled executions not being executed Fix ScheduleExecutions: inverted comparison prevented execution scheduling Dec 7, 2025
Copilot AI requested a review from stnguyen90 December 7, 2025 21:54
This prevents the warning:

Swoole\Coroutine::sleep(): Timer must be greater than or equal to 0.001
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 8, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
imagemagick 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-c++ 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-dev 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-heic 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-jpeg 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-jxl 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-libs 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-openexr 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-webp 7.1.2.3-r0 CVE-2025-62171 HIGH
libecpg 17.6-r0 CVE-2025-12818 HIGH
libecpg-dev 17.6-r0 CVE-2025-12818 HIGH
libpng 1.6.47-r0 CVE-2025-64720 HIGH
libpng 1.6.47-r0 CVE-2025-65018 HIGH
libpng-dev 1.6.47-r0 CVE-2025-64720 HIGH
libpng-dev 1.6.47-r0 CVE-2025-65018 HIGH
libpq 17.6-r0 CVE-2025-12818 HIGH
libpq-dev 17.6-r0 CVE-2025-12818 HIGH
libxml2 2.13.8-r0 CVE-2025-49794 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49796 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49795 HIGH
libxml2 2.13.8-r0 CVE-2025-6021 HIGH
postgresql17-dev 17.6-r0 CVE-2025-12818 HIGH
github.com/containerd/containerd/v2 v2.0.2 CVE-2024-25621 HIGH
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH
golang.org/x/oauth2 v0.24.0 CVE-2025-22868 HIGH
stdlib 1.22.10 CVE-2025-47907 HIGH
stdlib 1.22.10 CVE-2025-58183 HIGH
stdlib 1.22.10 CVE-2025-58186 HIGH
stdlib 1.22.10 CVE-2025-58187 HIGH
stdlib 1.22.10 CVE-2025-61729 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

@stnguyen90
Copy link
Copy Markdown
Contributor

Tested by:

  1. stopping the appwrite-task-scheduler-executions container
  2. creating a delayed execution for a few minutes in the future
  3. waiting for the time when the execution is supposed to trigger
  4. starting the appwrite-task-scheduler-executions container

Prior to this change, the executions were never triggered. After this change, all the old ones triggered.

@stnguyen90 stnguyen90 marked this pull request as ready for review December 8, 2025 19:35
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 8, 2025

✨ Benchmark results

  • Requests per second: 1,166
  • Requests with 200 status code: 209,998
  • P99 latency: 0.165428347

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,166 1,217
200 209,998 219,157
P99 0.165428347 0.168038276

@stnguyen90 stnguyen90 merged commit 3a3c921 into 1.8.x Dec 8, 2025
43 checks passed
@stnguyen90 stnguyen90 deleted the copilot/fix-schedule-executions-bug branch December 8, 2025 20:22
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.

3 participants