Skip to content

Conversation

@F4RAN
Copy link
Contributor

@F4RAN F4RAN commented Dec 18, 2025

closes #19404

Summary

This PR fixes an issue where setting a deployment concurrency limit while flows are already in RUNNING state does not immediately apply the limit to those running flows. The root cause is that SecureFlowConcurrencySlots orchestration rule only applies to flows transitioning to PENDING state, so flows already RUNNING never acquire leases when a limit is set. This fix modifies the update_deployment API endpoint to retroactively acquire concurrency slots and create leases for existing RUNNING flows when a limit is added or decreased, ensuring that no further flows can start until the number of running flows falls below the limit. This is particularly useful when a sudden spike in flow runs needs to be capped immediately, as previously this could only be achieved by setting the limit to 0 and increasing it again once flows drained. The implementation includes useful unit tests verifying both adding a limit and decreasing a limit scenarios.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
    I've not removed any docs
  • If this pull request adds functions or classes, it includes helpful docstrings.
    I've not added any new function or class

@github-actions github-actions bot added the enhancement An improvement of an existing feature label Dec 18, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 18, 2025

CodSpeed Performance Report

Merging #19863 will not alter performance

Comparing F4RAN:19404-running-concurrency-limit (c569d19) with main (f14ad4d)

Summary

✅ 2 untouched

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply concurrency limit to already submitted flows

1 participant