Skip to content

Open-source status page, incident response and uptime monitoring

add retry to status update (#1696)

Thibault Le Ouay403c245c9dfc
diff --git a/package.json b/package.json
index 61e8bfef2..5b3f3863d 100644
--- a/package.json
+++ b/package.json
@@ -23,8 +23,8 @@
"@biomejs/biome": "1.8.3",
"@turbo/gen": "1.13.3",
"oxfmt": "0.20.0",
- "oxlint": "1.35.0",
- "oxlint-tsgolint": "0.10.0",
+ "oxlint": "1.36.0",
+ "oxlint-tsgolint": "0.10.1",
"@types/node": "24.0.8",
"knip": "5.75.1",
"turbo": "2.6.3",
diff --git a/packages/emails/package.json b/packages/emails/package.json
index 965a19848..d30faf155 100644
--- a/packages/emails/package.json
+++ b/packages/emails/package.json
@@ -17,6 +17,7 @@
"@react-email/render": "2.0.0",
"@react-email/tailwind": "2.0.1",
"@t3-oss/env-core": "0.13.10",
+ "effect": "3.19.12",
"react-email": "5.0.8",
"resend": "6.6.0",
"zod": "4.1.13"
diff --git a/packages/emails/src/client.tsx b/packages/emails/src/client.tsx
index 3949609bc..778180781 100644
--- a/packages/emails/src/client.tsx
+++ b/packages/emails/src/client.tsx
@@ -1,6 +1,7 @@
/** @jsxImportSource react */
import { render } from "@react-email/render";
+import { Effect, Schedule } from "effect";
import { Resend } from "resend";
import FollowUpEmail from "../emails/followup";
import type { MonitorAlertProps } from "../emails/monitor-alert";
@@ -98,35 +99,38 @@ export class EmailClient {
return;
}
- try {
- const html = await render(<StatusReportEmail {...req} />);
-
- for (const recipients of chunk(req.to, 100)) {
- const result = await this.client.batch.send(
- recipients.map((subscriber) => ({
- from: `${req.pageTitle} <[email protected]>`,
- subject: req.reportTitle,
- to: subscriber,
- html,
- })),
- );
-
- if (result.error) {
- console.error(
- `Error sending status report update batch to ${recipients}: ${result.error}`,
- );
- }
- }
-
- console.log(
- `Sent status report update email to ${req.to.length} subscribers`,
- );
- } catch (err) {
- console.error(
- `Error sending status report update email to ${req.to}`,
- err,
+ const html = await render(<StatusReportEmail {...req} />);
+
+ for (const recipients of chunk(req.to, 100)) {
+ const sendEmail = Effect.tryPromise({
+ try: () =>
+ this.client.batch.send(
+ recipients.map((subscriber) => ({
+ from: `${req.pageTitle} <[email protected]>`,
+ subject: req.reportTitle,
+ to: subscriber,
+ html,
+ })),
+ ),
+ catch: (_unknown) =>
+ new Error(
+ `Error sending status report update batch to ${recipients}`,
+ ),
+ }).pipe(
+ Effect.andThen((result) =>
+ result.error ? Effect.fail(result.error) : Effect.succeed(result),
+ ),
+ Effect.retry({
+ times: 3,
+ schedule: Schedule.exponential("1000 millis"),
+ }),
);
+ await Effect.runPromise(sendEmail).catch(console.error);
}
+
+ console.log(
+ `Sent status report update email to ${req.to.length} subscribers`,
+ );
}
public async sendTeamInvitation(req: TeamInvitationProps & { to: string }) {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9787d8f8c..cb2da2a73 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -27,11 +27,11 @@ importers:
specifier: 0.20.0
version: 0.20.0
oxlint:
- specifier: 1.35.0
- version: 1.35.0([email protected])
+ specifier: 1.36.0
+ version: 1.36.0([email protected])
oxlint-tsgolint:
- specifier: 0.10.0
- version: 0.10.0
+ specifier: 0.10.1
+ version: 0.10.1
turbo:
specifier: 2.6.3
version: 2.6.3
@@ -1372,6 +1372,9 @@ importers:
'@t3-oss/env-core':
specifier: 0.13.10
+ effect:
+ specifier: 3.19.12
+ version: 3.19.12
react-email:
specifier: 5.0.8
version: 5.0.8
@@ -4036,73 +4039,73 @@ packages:
cpu: [x64]
os: [win32]
- '@oxlint-tsgolint/[email protected]':
- resolution: {integrity: sha512-mhBF/pjey0UdLL1ocU46Fqta+uJuRfqrLfDpcViRg17BtDiUNd8JY9iN2FOoS2HGSCAgCUjZ0AZkwkHwFs/VTw==}
+ '@oxlint-tsgolint/[email protected]':
+ resolution: {integrity: sha512-KGC4++BeEqrIcmDHiJt/e6/860PWJmUJjjp0mE+smpBmRXMjmOFFjrPmN+ZyCyVgf1WdmhPkQXsRSPeTR+2omw==}
cpu: [arm64]
os: [darwin]
- '@oxlint-tsgolint/[email protected]':
- resolution: {integrity: sha512-roLi34mw/i1z+NS7luboix55SXyhVv38dNUTcRDkk+0lNPzI9ngrM+1y1N2oBSUmz5o9OZGnfJJ7BSGCw/fFEQ==}
+ '@oxlint-tsgolint/[email protected]':
+ resolution: {integrity: sha512-tvmrDgj3Q0tdc+zMWfCVLVq8EQDEUqasm1zaWgSMYIszpID6qdgqbT+OpWWXV9fLZgtvrkoXGwxkHAUJzdVZXQ==}
cpu: [x64]
os: [darwin]
- '@oxlint-tsgolint/[email protected]':
- resolution: {integrity: sha512-HL9NThPH1V2F6l9XhwNmhQZUknN4m4yQYEvQFFGfZTYN6cvEEBIiqfF4KvBUg8c0xadMbQlW+Ug7/ybA9Nn+CA==}
+ '@oxlint-tsgolint/[email protected]':
+ resolution: {integrity: sha512-7kD28z6/ykGx8WetKTPRZt30pd+ziassxg/8cM24lhjUI+hNXyRHVtHes73dh9D6glJKno+1ut+3amUdZBZcpQ==}
cpu: [arm64]
os: [linux]
- '@oxlint-tsgolint/[email protected]':
- resolution: {integrity: sha512-Tw8QNq8ab+4+qE5krvJyMA66v6XE3GoiISRD5WmJ7YOxUnu//jSw/bBm7OYf/TNEZyeV0BTR7zXzhT5R+VFWlQ==}
+ '@oxlint-tsgolint/[email protected]':
+ resolution: {integrity: sha512-NmJmiqdzYUTHIxteSTyX6IFFgnIsOAjRWXfrS6Jbo5xlB3g39WHniSF3asB/khLJNtwSg4InUS34NprYM7zrEw==}
cpu: [x64]
os: [linux]
- '@oxlint-tsgolint/[email protected]':
- resolution: {integrity: sha512-LTogmTRwpwQqVaH1Ama8Wd5/VVZWBSF8v5qTbeT628+1F5Kt1V5eHBvyFh4oN18UCZlgqrh7DqkDhsieXUaC8Q==}
+ '@oxlint-tsgolint/[email protected]':
+ resolution: {integrity: sha512-3KrT80vl3nXUkjuJI/z8dF6xWsKx0t9Tz4ZQHgQw3fYw+CoihBRWGklrdlmCz+EGfMyVaQLqBV9PZckhSqLe2A==}
cpu: [arm64]
os: [win32]
- '@oxlint-tsgolint/[email protected]':
- resolution: {integrity: sha512-ygqxx8EmNWy9/wCQS5uXq9k/o2EyYNwNxY1ZHNzlmZC/kV06Aemx5OBDafefawBNqH7xTZPfccUrjdiy+QlTrw==}
+ '@oxlint-tsgolint/[email protected]':
+ resolution: {integrity: sha512-hW1fSJZVxG51sLdGq1sQjOzb1tsQ23z/BquJfUwL7CqBobxr7TJvGmoINL+9KryOJt0jCoaiMfWe4yoYw5XfIA==}
cpu: [x64]
os: [win32]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-ieiYVHkNZPo77Hgrxav595wGS4rRNKuDNrljf+4xhwpJsddrxMpM64IQUf2IvR3MhK4FxdGzhhB6OVmGVHY5/w==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-MJkj82GH+nhvWKJhSIM6KlZ8tyGKdogSQXtNdpIyP02r/tTayFJQaAEWayG2Jhsn93kske+nimg5MYFhwO/rlg==}
cpu: [arm64]
os: [darwin]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-1jNHu3j66X5jKySvgtE+jGtjx4ye+xioAucVTi2IuROZO6keK2YG74pnD+9FT+DpWZAtWRZGoW0r0x6aN9sEEg==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-VvEhfkqj/99dCTqOcfkyFXOSbx4lIy5u2m2GHbK4WCMDySokOcMTNRHGw8fH/WgQ5cDrDMSTYIGQTmnBGi9tiQ==}
cpu: [x64]
os: [darwin]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-T1lc0UaYbTxZyqVpLfC7eipbauNG8pBpkaZEW4JGz8Y68rxTH7d9s+CF0zxUxNr5RCtcmT669RLVjQT7VrKVLg==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-EMx92X5q+hHc3olTuj/kgkx9+yP0p/AVs4yvHbUfzZhBekXNpUWxWvg4hIKmQWn+Ee2j4o80/0ACGO0hDYJ9mg==}
cpu: [arm64]
os: [linux]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-7Wv5Pke9kwWKFycUziSHsmi3EM0389TLzraB0KE/MArrKxx30ycwfJ5PYoMj9ERoW+Ybs0txdaOF/xJy/XyYkg==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-7YCxtrPIctVYLqWrWkk8pahdCxch6PtsaucfMLC7TOlDt4nODhnQd4yzEscKqJ8Gjrw1bF4g+Ngob1gB+Qr9Fw==}
cpu: [arm64]
os: [linux]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-HDMPOzyVVy+rQl3H7UOq8oGHt7m1yaiWCanlhAu4jciK8dvXeO9OG/OQd74lD/h05IcJh93pCLEJ3wWOG8hTiQ==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-lnaJVlx5r3NWmoOMesfQXJSf78jHTn8Z+sdAf795Kgteo72+qGC1Uax2SToCJVN2J8PNG3oRV5bLriiCNR2i6Q==}
cpu: [x64]
os: [linux]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-kAPBBsUOM3HQQ6n3nnZauvFR9EoXqCSoj4O3OSXXarzsRTiItNrHabVUwxeswZEc+xMzQNR0FHEWg/d4QAAWLw==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-AhuEU2Qdl66lSfTGu/Htirq8r/8q2YnZoG3yEXLMQWnPMn7efy8spD/N1NA7kH0Hll+cdfwgQkQqC2G4MS2lPQ==}
cpu: [x64]
os: [linux]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-qrpBkkOASS0WT8ra9xmBRXOEliN6D/MV9JhI/68lFHrtLhfFuRwg4AjzjxrCWrQCnQ0WkvAVpJzu73F4ICLYZw==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-GlWCBjUJY2QgvBFuNRkiRJu7K/djLmM0UQKfZV8IN+UXbP/JbjZHWKRdd4LXlQmzoz7M5Hd6p+ElCej8/90FCg==}
cpu: [arm64]
os: [win32]
- '@oxlint/[email protected]':
- resolution: {integrity: sha512-yPFcj6umrhusnG/kMS5wh96vblsqZ0kArQJS+7kEOSJDrH+DsFWaDCsSRF8U6gmSmZJ26KVMU3C3TMpqDN4M1g==}
+ '@oxlint/[email protected]':
+ resolution: {integrity: sha512-J+Vc00Utcf8p77lZPruQgb0QnQXuKnFogN88kCnOqs2a83I+vTBB8ILr0+L9sTwVRvIDMSC0pLdeQH4svWGFZg==}
cpu: [x64]
os: [win32]
@@ -9350,12 +9353,12 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
- resolution: {integrity: sha512-LDDSIu5J/4D4gFUuQQIEQpAC6maNEbMg4nC8JL/+Pe0cUDR86dtVZ09E2x5MwCh8f9yfktoaxt5x6UIVyzrajg==}
+ resolution: {integrity: sha512-EEHNdo5cW2w1xwYdBQ7d3IXDqWAtMkfVFrh+9gQ4kYbYJwygY4QXSh1eH80/xVipZdVKujAwBgg/nNNHk56kxQ==}
hasBin: true
- resolution: {integrity: sha512-QDX1aUgaiqznkGfTM2qHwva2wtKqhVoqPSVXrnPz+yLUhlNadikD3QRuRtppHl7WGuy3wG6nKAuR8lash3aWSg==}
+ resolution: {integrity: sha512-IicUdXfXgI8OKrDPnoSjvBfeEF8PkKtm+CoLlg4LYe4ypc8U+T4r7730XYshdBGZdelg+JRw8GtCb2w/KaaZvw==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
peerDependencies:
@@ -13640,46 +13643,46 @@ snapshots:
optional: true
- '@oxlint-tsgolint/[email protected]':
+ '@oxlint-tsgolint/[email protected]':
optional: true
- '@oxlint-tsgolint/[email protected]':
+ '@oxlint-tsgolint/[email protected]':
optional: true
- '@oxlint-tsgolint/[email protected]':
+ '@oxlint-tsgolint/[email protected]':
optional: true
- '@oxlint-tsgolint/[email protected]':
+ '@oxlint-tsgolint/[email protected]':
optional: true
- '@oxlint-tsgolint/[email protected]':
+ '@oxlint-tsgolint/[email protected]':
optional: true
- '@oxlint-tsgolint/[email protected]':
+ '@oxlint-tsgolint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
- '@oxlint/[email protected]':
+ '@oxlint/[email protected]':
optional: true
'@pagefind/[email protected]':
@@ -19669,26 +19672,26 @@ snapshots:
'@oxfmt/win32-arm64': 0.20.0
'@oxfmt/win32-x64': 0.20.0
optionalDependencies:
- '@oxlint-tsgolint/darwin-arm64': 0.10.0
- '@oxlint-tsgolint/darwin-x64': 0.10.0
- '@oxlint-tsgolint/linux-arm64': 0.10.0
- '@oxlint-tsgolint/linux-x64': 0.10.0
- '@oxlint-tsgolint/win32-arm64': 0.10.0
- '@oxlint-tsgolint/win32-x64': 0.10.0
-
+ '@oxlint-tsgolint/darwin-arm64': 0.10.1
+ '@oxlint-tsgolint/darwin-x64': 0.10.1
+ '@oxlint-tsgolint/linux-arm64': 0.10.1
+ '@oxlint-tsgolint/linux-x64': 0.10.1
+ '@oxlint-tsgolint/win32-arm64': 0.10.1
+ '@oxlint-tsgolint/win32-x64': 0.10.1
+
optionalDependencies:
- '@oxlint/darwin-arm64': 1.35.0
- '@oxlint/darwin-x64': 1.35.0
- '@oxlint/linux-arm64-gnu': 1.35.0
- '@oxlint/linux-arm64-musl': 1.35.0
- '@oxlint/linux-x64-gnu': 1.35.0
- '@oxlint/linux-x64-musl': 1.35.0
- '@oxlint/win32-arm64': 1.35.0
- '@oxlint/win32-x64': 1.35.0
- oxlint-tsgolint: 0.10.0
+ '@oxlint/darwin-arm64': 1.36.0
+ '@oxlint/darwin-x64': 1.36.0
+ '@oxlint/linux-arm64-gnu': 1.36.0
+ '@oxlint/linux-arm64-musl': 1.36.0
+ '@oxlint/linux-x64-gnu': 1.36.0
+ '@oxlint/linux-x64-musl': 1.36.0
+ '@oxlint/win32-arm64': 1.36.0
+ '@oxlint/win32-x64': 1.36.0
+ oxlint-tsgolint: 0.10.1
dependencies: