Skip to content

fix: correct failed requests delta count in periodic log message#3482

Merged
barjin merged 2 commits intomasterfrom
copilot/fix-failed-requests-display
Mar 13, 2026
Merged

fix: correct failed requests delta count in periodic log message#3482
barjin merged 2 commits intomasterfrom
copilot/fix-failed-requests-display

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

getOperationMode() mutates previousState before the ERROR message computes the delta, making this.stats.state.requestsFailed - previousState.requestsFailed always 0. The || this.stats.state.requestsFailed fallback then prints the total failed count instead of the interval delta.

Changes

  • getPeriodicLogger — changed getOperationMode() return type from 'ERROR' | 'REGULAR' to { mode, failedDelta }, exposing the delta already computed before previousState is overwritten
  • Removed the broken ... - previousState.requestsFailed || this.stats.state.requestsFailed expression; message now uses failedDelta directly
// Before — previousState already updated when this runs, delta always 0
message = `Experiencing problems, ${
    this.stats.state.requestsFailed - previousState.requestsFailed || this.stats.state.requestsFailed
} failed requests in the past ${this.statusMessageLoggingInterval} seconds.`;

// After — delta captured inside getOperationMode() before previousState is mutated
const { mode: operationMode, failedDelta } = getOperationMode();
// ...
message = `Experiencing problems, ${failedDelta} failed requests in the past ${this.statusMessageLoggingInterval} seconds.`;

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Closes #3483

Co-authored-by: barjin <61918049+barjin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect failed requests display in Crawlee fix: correct failed requests delta count in periodic log message Mar 13, 2026
Copilot AI requested a review from barjin March 13, 2026 10:27
Copy link
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

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

Looking at this, I suppose we always logged the wrong number here (previousState would always be equal to this.stats.state), so the message would always log this.stats.state.requestsFailed 👀

@barjin barjin marked this pull request as ready for review March 13, 2026 10:34
@github-actions github-actions bot added this to the 136th sprint - Tooling team milestone Mar 13, 2026
@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Mar 13, 2026
@barjin barjin added the adhoc Ad-hoc unplanned task added during the sprint. label Mar 13, 2026
@barjin barjin merged commit a098f42 into master Mar 13, 2026
12 of 14 checks passed
@barjin barjin deleted the copilot/fix-failed-requests-display branch March 13, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants