Checkpoint after starting plan
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Drop existing tables
|
||||
psql $DATABASE_URL -c "DROP TABLE IF EXISTS newsletter_notifications CASCADE;"
|
||||
psql $DATABASE_URL -c "DROP TABLE IF EXISTS newsletters CASCADE;"
|
||||
psql $DATABASE_URL -c "DROP TABLE IF EXISTS subscriptions CASCADE;"
|
||||
psql $DATABASE_URL -c "DROP TABLE IF EXISTS _prisma_migrations CASCADE;"
|
||||
|
||||
@@ -10,7 +10,7 @@ async function scrapeNewsletterContent(
|
||||
retryCount = 0,
|
||||
): Promise<{ thumbnail: string | null; content: string | null }> {
|
||||
try {
|
||||
const backoffTime = Math.min(1000 * Math.pow(2, retryCount), 10000); // Exponential backoff capped at 10 seconds
|
||||
const backoffTime = Math.min(1000 * Math.pow(2, retryCount), 1000); // Exponential backoff capped at 10 seconds
|
||||
if (retryCount > 0) {
|
||||
await new Promise((resolve) => setTimeout(resolve, backoffTime));
|
||||
}
|
||||
@@ -28,7 +28,7 @@ async function scrapeNewsletterContent(
|
||||
|
||||
if (
|
||||
data.includes("AwsWafIntegration.checkForceRefresh") &&
|
||||
retryCount < 3
|
||||
retryCount < 1
|
||||
) {
|
||||
console.log(`AWS WAF detected, waiting before retry ${retryCount + 1}/3`);
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
@@ -51,7 +51,7 @@ async function scrapeNewsletterContent(
|
||||
} catch (error: any) {
|
||||
if (
|
||||
(error.response?.status === 429 || error.code === "ECONNRESET") &&
|
||||
retryCount < 5
|
||||
retryCount < 1
|
||||
) {
|
||||
console.log(
|
||||
`Rate limited or connection reset, attempt ${retryCount + 1}/5`,
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { pgTable, text, serial, date, timestamp } from "drizzle-orm/pg-core";
|
||||
import {
|
||||
pgTable,
|
||||
text,
|
||||
serial,
|
||||
date,
|
||||
timestamp,
|
||||
boolean,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -51,6 +58,9 @@ export const notificationSettings = pgTable("notification_settings", {
|
||||
updated_at: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const insertNotificationSettingsSchema = createInsertSchema(notificationSettings);
|
||||
export type InsertNotificationSettings = z.infer<typeof insertNotificationSettingsSchema>;
|
||||
export type NotificationSettings = typeof notificationSettings.$inferSelect;
|
||||
export const insertNotificationSettingsSchema =
|
||||
createInsertSchema(notificationSettings);
|
||||
export type InsertNotificationSettings = z.infer<
|
||||
typeof insertNotificationSettingsSchema
|
||||
>;
|
||||
export type NotificationSettings = typeof notificationSettings.$inferSelect;
|
||||
|
||||
Reference in New Issue
Block a user