Skip to content

Commit

Permalink
#patch reducing supa usage and keep db entries for persistent messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaribsin committed Sep 19, 2024
1 parent 3715a30 commit c4ab13a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const configObj: Record<string, string | number | undefined> = {
AHG_ANNOUNCEMENTS_CHANNEL: '1243296967656996975',

// Cron job intervals
PERSISTENT_MESSAGE_INTERVAL: '*/30 * * * *', // every 30 minutes
API_UPDATE_INTERVAL: '*/30 * * * * *', // every 20 seconds
STATUS_UPDATE_INTERVAL: '*/3 * * * * *', // every 3 seconds
DB_DATA_INTERVAL: '0 * * * *', // every 1 hour
COMPARE_INTERVAL: '*/20 * * * * *', // every 20 seconds
PERSISTENT_MESSAGE_INTERVAL: '*/30 * * * *', // every 30 minutes (discord API limits -- somewhat intensive)
API_UPDATE_INTERVAL: '*/30 * * * * *', // every 30 seconds (fly egress -- not intensive)
STATUS_UPDATE_INTERVAL: '*/3 * * * * *', // update discord status every 3 seconds (discord egress -- not intensive)
DB_DATA_INTERVAL: '0 * * * *', // store new API data every 1 hour (supabase egress -- somewhat intensive)
COMPARE_INTERVAL: '*/15 * * * *', // compare full API data every 15 minutes (supabase egress -- very intensive)

// Database config
DATABASE_URL: process.env.DATABASE_URL,
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export async function updateMessages() {
type: 'update',
...err,
});
db.delete(persistentMessages)
.where(eq(persistentMessages.messageId, message.messageId))
.catch();
// db.delete(persistentMessages)
// .where(eq(persistentMessages.messageId, message.messageId))
// .catch();
return null;
});
});
Expand Down

0 comments on commit c4ab13a

Please sign in to comment.