Skip to content

Commit 218c0c3

Browse files
authored
Merge branch 'main' into feat/adds-helm-charts
2 parents 89878b8 + 6d3b761 commit 218c0c3

File tree

37 files changed

+5641
-784
lines changed

37 files changed

+5641
-784
lines changed

.changeset/orange-cows-tease.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/cli": patch
3+
---
4+
5+
add ability to use custom tunnel in dev command

.changeset/slimy-moles-smash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Updated icon documentation in runTasks

.changeset/twenty-mangos-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/cli": patch
3+
---
4+
5+
Added Next.js `maxDuration` commented out to the api/trigger file using CLI init

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ We provide an official trigger.dev docker image you can use to easily self-host
9696

9797
To setup and develop locally or contribute to the open source project, follow our [development guide](./CONTRIBUTING.md).
9898

99-
## 🙏 to our contributors
99+
## Meet the Amazing People Behind This Project 🚀
100100

101101
<a href="https://github.com/triggerdotdev/trigger.dev/graphs/contributors">
102102
<img src="https://contrib.rocks/image?repo=triggerdotdev/trigger.dev" />

apps/webapp/app/components/primitives/NamedIcon.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ import { Spinner } from "./Spinner";
6868
import { SaplingIcon } from "~/assets/icons/SaplingIcon";
6969
import { TwoTreesIcon } from "~/assets/icons/TwoTreesIcon";
7070
import { OneTreeIcon } from "~/assets/icons/OneTreeIcon";
71+
import { tablerIcons } from "~/utils/tablerIcons";
72+
import tablerSpritePath from "./tabler-sprite.svg";
7173

7274
const icons = {
7375
account: (className: string) => <UserCircleIcon className={cn("text-slate-400", className)} />,
@@ -215,6 +217,12 @@ export function NamedIcon({
215217
);
216218
}
217219

220+
if (tablerIcons.has("tabler-" + name)) {
221+
return <TablerIcon name={"tabler-" + name} className={className} />;
222+
} else if (name.startsWith("tabler-") && tablerIcons.has(name)) {
223+
return <TablerIcon name={name} className={className} />;
224+
}
225+
218226
console.log(`Icon ${name} not found`);
219227

220228
if (fallback) {
@@ -247,3 +255,11 @@ export function NamedIconInBox({
247255
</div>
248256
);
249257
}
258+
259+
export function TablerIcon({ name, className }: { name: string; className?: string }) {
260+
return (
261+
<svg className={cn("stroke-[1.5]", className)}>
262+
<use xlinkHref={`${tablerSpritePath}#${name}`} />
263+
</svg>
264+
);
265+
}

apps/webapp/app/components/primitives/tabler-sprite.svg

Lines changed: 1 addition & 0 deletions
Loading

apps/webapp/app/components/stories/NamedIcon.stories.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22
import { withDesign } from "storybook-addon-designs";
33
import { NamedIcon, iconNames } from "../primitives/NamedIcon";
4+
import { tablerIcons } from "~/utils/tablerIcons";
5+
import { Header1 } from "../primitives/Headers";
46

57
const meta: Meta<typeof NamedIcons> = {
68
title: "Icons",
@@ -25,17 +27,35 @@ export const Basic: Story = {
2527

2628
function NamedIcons() {
2729
return (
28-
<div className="grid grid-cols-8 gap-4">
29-
{iconNames
30-
.sort((a, b) => a.localeCompare(b))
31-
.map((iconName) => (
32-
<div key={iconName} className="flex items-center gap-2">
33-
<div>
34-
<NamedIcon name={iconName} className={"h-6 w-6"} />
30+
<div className="flex flex-col gap-4">
31+
<div>
32+
<Header1 spacing>Internal</Header1>
33+
<div className="grid grid-cols-8 gap-4">
34+
{iconNames
35+
.sort((a, b) => a.localeCompare(b))
36+
.map((iconName) => (
37+
<div key={iconName} className="flex items-center gap-2">
38+
<div>
39+
<NamedIcon name={iconName} className={"h-6 w-6"} />
40+
</div>
41+
<span className="text-xs text-dimmed">{iconName}</span>
42+
</div>
43+
))}
44+
</div>
45+
</div>
46+
<div>
47+
<Header1 spacing>Tabler</Header1>
48+
<div className="grid grid-cols-8 gap-4">
49+
{Array.from(tablerIcons).map((iconName) => (
50+
<div key={iconName} className="flex items-center gap-2">
51+
<div>
52+
<NamedIcon name={iconName} className={"h-6 w-6 text-indigo-500"} />
53+
</div>
54+
<span className="text-xs text-dimmed">{iconName}</span>
3555
</div>
36-
<span className="text-xs text-dimmed">{iconName}</span>
37-
</div>
38-
))}
56+
))}
57+
</div>
58+
</div>
3959
</div>
4060
);
4161
}

apps/webapp/app/env.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const EnvironmentSchema = z.object({
4040
EXECUTION_WORKER_POLL_INTERVAL: z.coerce.number().int().default(1000),
4141
WORKER_ENABLED: z.string().default("true"),
4242
EXECUTION_WORKER_ENABLED: z.string().default("true"),
43+
GRACEFUL_SHUTDOWN_TIMEOUT: z.coerce.number().int().default(60000),
4344
});
4445

4546
export type Environment = z.infer<typeof EnvironmentSchema>;

apps/webapp/app/platform/zodWorker.server.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export type ZodWorkerOptions<TMessageCatalog extends MessageCatalogSchema> = {
102102
recurringTasks?: ZodRecurringTasks;
103103
cleanup?: ZodWorkerCleanupOptions;
104104
reporter?: ZodWorkerReporter;
105+
shutdownTimeoutInMs?: number;
105106
};
106107

107108
export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
@@ -114,6 +115,8 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
114115
#runner?: GraphileRunner;
115116
#cleanup: ZodWorkerCleanupOptions | undefined;
116117
#reporter?: ZodWorkerReporter;
118+
#shutdownTimeoutInMs?: number;
119+
#shuttingDown = false;
117120

118121
constructor(options: ZodWorkerOptions<TMessageCatalog>) {
119122
this.#name = options.name;
@@ -124,6 +127,7 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
124127
this.#recurringTasks = options.recurringTasks;
125128
this.#cleanup = options.cleanup;
126129
this.#reporter = options.reporter;
130+
this.#shutdownTimeoutInMs = options.shutdownTimeoutInMs ?? 60000; // default to 60 seconds
127131
}
128132

129133
get graphileWorkerSchema() {
@@ -143,6 +147,7 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
143147

144148
this.#runner = await graphileRun({
145149
...this.#runnerOptions,
150+
noHandleSignals: true,
146151
taskList: this.#createTaskListFromTasks(),
147152
parsedCronItems,
148153
});
@@ -199,9 +204,36 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
199204
this.#logDebug("stop");
200205
});
201206

207+
process.on("SIGTERM", this._handleSignal("SIGTERM").bind(this));
208+
process.on("SIGINT", this._handleSignal("SIGINT").bind(this));
209+
202210
return true;
203211
}
204212

213+
private _handleSignal(signal: string) {
214+
return () => {
215+
if (this.#shuttingDown) {
216+
return;
217+
}
218+
219+
this.#shuttingDown = true;
220+
221+
if (this.#shutdownTimeoutInMs) {
222+
setTimeout(() => {
223+
this.#logDebug("Shutdown timeout reached, exiting process");
224+
225+
process.exit(0);
226+
}, this.#shutdownTimeoutInMs);
227+
}
228+
229+
this.#logDebug(`Received ${signal}, shutting down zodWorker...`);
230+
231+
this.stop().finally(() => {
232+
this.#logDebug("zodWorker stopped");
233+
});
234+
};
235+
}
236+
205237
public async stop() {
206238
await this.#runner?.stop();
207239
}

apps/webapp/app/presenters/RunListPresenter.server.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,24 @@ export class RunListPresenter {
100100
let previous: string | undefined;
101101
switch (direction) {
102102
case "forward":
103+
previous = cursor ? runs.at(0)?.id : undefined;
103104
if (hasMore) {
104105
next = runs[PAGE_SIZE - 1]?.id;
105106
}
106-
previous = cursor ? runs.at(1)?.id : undefined;
107107
break;
108108
case "backward":
109109
if (hasMore) {
110-
next = runs[PAGE_SIZE - 1]?.id;
110+
previous = runs[1]?.id;
111111
}
112-
previous = runs.at(1)?.id;
112+
next = runs[PAGE_SIZE - 1]?.id;
113113
break;
114114
}
115115

116+
const runsToReturn =
117+
direction === "backward" && hasMore ? runs.slice(1, PAGE_SIZE + 1) : runs.slice(0, PAGE_SIZE);
118+
116119
return {
117-
runs: runs.slice(0, PAGE_SIZE).map((run) => ({
120+
runs: runsToReturn.map((run) => ({
118121
id: run.id,
119122
number: run.number,
120123
startedAt: run.startedAt,

0 commit comments

Comments
 (0)