Skip to content

Conversation

@FrozenPandaz
Copy link
Collaborator

@FrozenPandaz FrozenPandaz commented Nov 1, 2025

Current Behavior

When processing scheduled batches, tasks are hashed one at a time even though the hasher has a hashTasks method for batch hashing.

Results from a batch with 109 tasks.

hash batch: 8.297s

Expected Behavior

Tasks without custom hashers should be batch-hashed using the hasher's hashTasks method for better performance.

Results from a batch with 109 tasks.

hash batch: 991.725ms

Related Issue(s)

This is a performance optimization for task hashing.


Changes:

  • Added a new hashTasks function that intelligently separates tasks with custom hashers from those without
  • Tasks with custom hashers are hashed individually using Promise.all
  • Tasks without custom hashers are batch-hashed using the hasher's hashTasks method
  • The function automatically filters out tasks that already have a hash
  • Updated processScheduledBatch in task-orchestrator to use this new function
Currently when processing scheduled batches, tasks are hashed one at a time even though the hasher has a hashTasks method for batch hashing.

This change introduces a new hashTasks function that:
- Filters out tasks that already have a hash
- Separates tasks with custom hashers from those without
- Uses Promise.all to hash tasks with custom hashers individually
- Uses the hasher's hashTasks method to batch-hash tasks without custom hashers for better performance

The processScheduledBatch method in task-orchestrator now uses this new function instead of mapping over individual hashTask calls.
@FrozenPandaz FrozenPandaz requested a review from a team as a code owner November 1, 2025 00:53
@vercel
Copy link

vercel bot commented Nov 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Nov 1, 2025 0:59am
@netlify
Copy link

netlify bot commented Nov 1, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit c2bb073
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69055a27dab4500008690fdb
😎 Deploy Preview https://deploy-preview-33327--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Nov 1, 2025

View your CI Pipeline Execution ↗ for commit c2bb073

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 7m 13s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 1m 57s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 10s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-03 14:28:03 UTC

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Nx Cloud has identified a possible root cause for your failed CI:

The failure is classified as 'environment_state' rather than 'code_change' for the following reasons:

  1. No Correlation Between Code Changes and Failure
    The PR modifies task hashing logic in hash-task.ts and task-orchestrator.ts, specifically optimizing how tasks are hashed by batching tasks without custom hashers. The failure occurs due to port 41404 already being in use (EADDRINUSE), which has no logical connection to task hashing optimizations.

  2. Resource Constraint Error
    The error "Error: listen EADDRINUSE: address already in use :::41404" is a classic environmental resource constraint. This indicates that the port was not properly released from a previous test run or process, which is an infrastructure/cleanup issue, not a code logic issue.

  3. No References to Changed Code
    The error output contains no references to hashTask, hashTasks, processScheduledBatch, or any other functions modified in the PR. The failure occurs entirely within the dev server startup phase of the E2E test infrastructure.

  4. Test Pattern Suggests Timing Issue
    The first test case with --js=false passed successfully (158207 ms), while the second test case with --js=true failed (154630 ms). This pattern is characteristic of timing or race conditions in test cleanup, not deterministic code failures.

  5. Failure in Test Infrastructure, Not Application Code
    The failure occurs during dev server initialization for module federation remotes, which is part of the E2E test infrastructure. The changed code affects task hashing during build/execution orchestration, which happens before the dev servers are even started.

  6. Environmental Indicators Present
    Multiple environmental indicators are present: ECONNREFUSED errors, EADDRINUSE error, and the web server timeout after 60000ms. These are all symptoms of environmental issues rather than code defects.

The PR's changes optimize task hashing performance and do not modify port allocation, dev server management, test cleanup logic, or any infrastructure code that would cause port conflicts.

A code change would likely not resolve this issue, so no action was taken.

Nx CloudView in Nx Cloud ↗


🎓 To learn more about Self Healing CI, please visit nx.dev

@FrozenPandaz FrozenPandaz merged commit 0acc8b0 into master Nov 3, 2025
25 of 26 checks passed
@FrozenPandaz FrozenPandaz deleted the hash-multi branch November 3, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants