Skip to content

Commit db9f9a2

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/dashboard-agent-flows
# Conflicts: # apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys/route.tsx
2 parents 9c6f148 + 0a44b88 commit db9f9a2

64 files changed

Lines changed: 5017 additions & 491 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"@trigger.dev/react-hooks": patch
4+
---
5+
6+
`debounce` now works when you pass an array of items to `batchTrigger` or `batchTriggerAndWait`, and when you trigger from `useTaskTrigger`. Previously the option was accepted by the types and dropped before the request was sent, so every trigger created its own run instead of collapsing onto the debounce key.
7+
8+
```ts
9+
await myTask.batchTrigger([
10+
{ payload: { id: "a" }, options: { debounce: { key: "same-key", delay: "30s" } } },
11+
{ payload: { id: "b" }, options: { debounce: { key: "same-key", delay: "30s" } } },
12+
]);
13+
```
14+
15+
The streaming (async iterable) forms of the batch calls were already forwarding `debounce` correctly.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
API rate limits now apply per environment, so creating extra API keys no longer increases how many requests an environment can make.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: feature
4+
---
5+
6+
Self-hosted deployments can now create multiple full-access API keys for each environment.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
Lower background database load during deployments and dev sessions for projects that use declarative schedules.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
Fix debounce doing nothing when the delay was longer than an hour, which made every trigger
7+
create its own run instead of collapsing onto the debounce key. Debounced runs now keep being
8+
pushed back for as long as triggers keep arriving, so set `maxDelay` when the work has to happen
9+
eventually, and settings that could never debounce are rejected rather than silently ignored.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
Creating or updating a schedule, and deploying a project with declarative schedules, is faster in long-lived projects with many deploys.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: feature
4+
---
5+
6+
Additional environment API keys can now create scoped public access tokens.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
Reject alert webhook destinations in reserved benchmarking IP ranges.

apps/webapp/app/consts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const RUN_CHUNK_EXECUTION_BUFFER = 350;
1010
export const MAX_RUN_CHUNK_EXECUTION_LIMIT = 120000; // 2 minutes
1111
export const VERCEL_RESPONSE_TIMEOUT_STATUS_CODES = [408, 504];
1212
export const MAX_BATCH_TRIGGER_ITEMS = 100;
13+
export const MAX_API_KEY_TASK_IDENTIFIERS = 10;
1314
export const MAX_TASK_RUN_ATTEMPTS = 250;
1415
export const BULK_ACTION_RUN_LIMIT = 250;
1516
export const MAX_JOB_RUN_EXECUTION_COUNT = 250;

apps/webapp/app/env.server.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ const OptionalIntEnv = z.preprocess(
114114
z.coerce.number().int().optional()
115115
);
116116

117+
/**
118+
* Optional int env var for a limit that can be switched off. Blank, whitespace and `0` all mean
119+
* "no limit" and normalise to undefined; anything else that is set must be greater than zero.
120+
*/
121+
const OptionalLimitEnv = z.preprocess((v) => {
122+
if (typeof v === "string" && (v.trim() === "" || Number(v.trim()) === 0)) {
123+
return undefined;
124+
}
125+
126+
return v === 0 ? undefined : v;
127+
}, z.coerce.number().int().positive().optional());
128+
117129
const EnvironmentSchema = z
118130
.object({
119131
NODE_ENV: z.union([z.literal("development"), z.literal("production"), z.literal("test")]),
@@ -1037,11 +1049,16 @@ const EnvironmentSchema = z
10371049
.default(60_000),
10381050
RUN_ENGINE_SUSPENDED_HEARTBEAT_RETRIES_FACTOR: z.coerce.number().default(2),
10391051

1040-
/** Maximum duration in milliseconds that a run can be debounced. Default: 1 hour (3,600,000ms) */
1041-
RUN_ENGINE_MAXIMUM_DEBOUNCE_DURATION_MS: z.coerce
1042-
.number()
1043-
.int()
1044-
.default(60_000 * 60), // 1 hour
1052+
/**
1053+
* Optional ceiling on how long a debounced run can be pushed back, measured from the first
1054+
* trigger. Unset by default: a continuously triggered debounce key is pushed back for as
1055+
* long as the triggers keep coming, and `debounce.maxDelay` on the trigger is the only
1056+
* bound. Setting this applies a ceiling to every debounced run that does not carry its own
1057+
* `maxDelay`, and any `delay` at or above it is rejected at trigger time. It is a default
1058+
* rather than an enforced limit: a trigger that sets `maxDelay` uses that value even when it
1059+
* is longer than this. `0` and blank both mean no ceiling.
1060+
*/
1061+
RUN_ENGINE_MAXIMUM_DEBOUNCE_DURATION_MS: OptionalLimitEnv,
10451062

10461063
/**
10471064
* Bucket size in milliseconds used to quantize the newly computed `delayUntil`

0 commit comments

Comments
 (0)