Implement custom retry handling of rate limit errors

This commit is contained in:
Dominic Ferrando
2026-07-13 16:32:20 -04:00
parent b408bb5439
commit fd94f22d21
7 changed files with 80 additions and 10 deletions
+4 -3
View File
@@ -7,9 +7,6 @@ import { Value } from "@sinclair/typebox/value";
import { sql } from "kysely";
import zipcodesUs from "zipcodes-us";
// TODO: read Retry-After header for how long to delay retry on 429 Too many Requests
// https://developers.webflow.com/data/reference/rate-limits ...(do printful too)
export class CommerceService {
readonly Printful = new PrintfulClient({
token: env.PRINTFUL_AUTH,
@@ -49,6 +46,7 @@ class ApparelOrdersService {
processor: async (payload) => {
const wOrder = payload.wOrder as Webflow.Orders.Order;
// creates a DRAFT order
await this.Printful.Orders.create({
external_id: wOrder.orderId,
// TODO: derive from webflow
@@ -69,6 +67,9 @@ class ApparelOrdersService {
quantity: wOrderSku.count,
})),
});
// TODO: confirm the above created order
// right now we manually review and confirm it in the printful portal
}
}),
"apparel_order_fulfill": defineEventType({