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