X Tutup
Skip to content

fix: correct loop variable in curl cleanup (streak fix)#889

Open
E-Kerem wants to merge 1 commit intoDenverCoder1:mainfrom
E-Kerem:fix/curl-cleanup-bug
Open

fix: correct loop variable in curl cleanup (streak fix)#889
E-Kerem wants to merge 1 commit intoDenverCoder1:mainfrom
E-Kerem:fix/curl-cleanup-bug

Conversation

@E-Kerem
Copy link

@E-Kerem E-Kerem commented Mar 9, 2026

Description

This PR fixes a bug in src/stats.php where the parallel contribution fetching loop used an incorrect variable in its cleanup phase.

Logic Bug

The cleanup loop declared $request but used $handle (a stale reference from the previous loop). This caused a resource leak by only removing the last handle and leaving others unreleased.

Impact on Streak Calculation

Leaking curl handles in a multi-batch environment can cause silent data-fetching failures. This leads to streaks appearing truncated or starting only from a recent year (like 2026) because data from previous years (like 2025) fails to load correctly into the stats array.

Fixes #886

Verified locally with user E-Kerem to ensure multi-year data is correctly merged and streaks are accurate.

Copilot AI review requested due to automatic review settings March 9, 2026 09:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a cURL multi-handle cleanup bug in src/stats.php where the cleanup loop removed a stale $handle reference instead of the actual per-request handle, preventing proper handle removal when fetching multiple years in parallel.

Changes:

  • Corrected the cleanup loop to remove each handle in $requests from the multi handle using the loop variable ($request) rather than a stale $handle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@E-Kerem E-Kerem changed the title fix: correct loop variable in curl cleanup fix: correct loop variable in curl cleanup (streak fix) Mar 9, 2026
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.

bug in streak calculation

2 participants

X Tutup