Implement custom retry handling of rate limit errors
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user