Skip to content

Commit 4f960a1

Browse files
committed
fix(webapp): limit rows only warn at their total bound, paused banner hides on the Concurrency page
A limit row's running count spans every concurrency key, so comparing it against the perKey cap tripped the at-limit warning on healthy limits; the warning and health badge now compare against the total bound and stay quiet for perKey-only limits. The paused-environment banner's Manage button hides again on the page it links to, which is /concurrency now.
1 parent 0b06843 commit 4f960a1

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

  • apps/webapp/app
    • components/billing
    • routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.concurrency

‎apps/webapp/app/components/billing/OrgBanner.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function OrgBanner() {
5454
showSelfServe,
5555
});
5656

57-
const hideQueuesButton = location.pathname.endsWith("/queues");
57+
const hideConcurrencyButton = location.pathname.endsWith("/concurrency");
5858
const hideBillingLimitBanner = location.pathname.endsWith("/settings/billing-limits");
5959

6060
switch (bannerKind) {
@@ -70,7 +70,7 @@ export function OrgBanner() {
7070
return isArchived ? (
7171
<ArchivedEnvironmentBanner />
7272
) : (
73-
<PausedEnvironmentBanner hideButton={hideQueuesButton} />
73+
<PausedEnvironmentBanner hideButton={hideConcurrencyButton} />
7474
);
7575
default:
7676
return null;

‎apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.concurrency/route.tsx‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,13 +773,22 @@ function QueuesWithMetricsView() {
773773
{queueRows.length > 0 ? (
774774
queueRows.map((queue) => {
775775
const limit = queue.concurrencyLimit ?? environment.concurrencyLimit;
776-
const isAtConcurrencyLimit = queue.running >= limit;
776+
const isLimit = queue.kind === "limit";
777+
/** A limit row's `running` counts holders across every key, so only its
778+
* total bound compares against it; a perKey-only limit has no aggregate
779+
* threshold and never reads as at-limit here. */
780+
const atLimitThreshold = isLimit
781+
? queue.concurrency?.combined?.current != null
782+
? Math.min(queue.concurrency.combined.current, environment.concurrencyLimit)
783+
: null
784+
: limit;
785+
const isAtConcurrencyLimit =
786+
atLimitThreshold !== null && queue.running >= atLimitThreshold;
777787
const isAtQueueLimit =
778788
environment.queueSizeLimit !== null &&
779789
queue.queued >= environment.queueSizeLimit;
780790
const queueFilterableName = queueMetricsKey(queue);
781791
const queueMetric = metricsByQueue[queueFilterableName];
782-
const isLimit = queue.kind === "limit";
783792
/** The detail page is queue observability (queue metrics, run filters, pause
784793
* and override actions); a limit's activity lives on each holder's home queue,
785794
* so limit rows don't link anywhere. */
@@ -1014,7 +1023,7 @@ function QueuesWithMetricsView() {
10141023
paused={queue.paused}
10151024
running={queue.running}
10161025
queued={queue.queued}
1017-
limit={limit}
1026+
limit={atLimitThreshold ?? 0}
10181027
/>
10191028
</TableCell>
10201029
<TableCell
@@ -1952,11 +1961,20 @@ function ClassicQueuesView() {
19521961
{queues.length > 0 ? (
19531962
queues.map((queue) => {
19541963
const limit = queue.concurrencyLimit ?? environment.concurrencyLimit;
1955-
const isAtConcurrencyLimit = queue.running >= limit;
1964+
const isLimit = queue.kind === "limit";
1965+
/** A limit row's `running` counts holders across every key, so only its
1966+
* total bound compares against it; a perKey-only limit has no aggregate
1967+
* threshold and never reads as at-limit here. */
1968+
const atLimitThreshold = isLimit
1969+
? queue.concurrency?.combined?.current != null
1970+
? Math.min(queue.concurrency.combined.current, environment.concurrencyLimit)
1971+
: null
1972+
: limit;
1973+
const isAtConcurrencyLimit =
1974+
atLimitThreshold !== null && queue.running >= atLimitThreshold;
19561975
const isAtQueueLimit =
19571976
environment.queueSizeLimit !== null &&
19581977
queue.queued >= environment.queueSizeLimit;
1959-
const isLimit = queue.kind === "limit";
19601978
const queueFilterableName = `${queue.type === "task" ? "task/" : ""}${
19611979
queue.name
19621980
}`;

0 commit comments

Comments
 (0)