Correct directory typo.

This commit is contained in:
Patrick Fic
2025-11-17 16:03:19 -08:00
parent cf888f650c
commit e8da1a6c26
2 changed files with 18 additions and 14 deletions

View File

@@ -60,18 +60,21 @@ export class DailyS3Scheduler {
SCHEDULER_QUEUE_NAME,
async (job) => {
logger.info(`[Scheduler] Processing job: ${job.name} (ID: ${job.id})`);
try {
if (job.name === "daily-s3-sync") {
await this.performDailySync();
//await this.performDailySync();
logger.info("[Scheduler] Daily sync job completed");
} else if (job.name === "daily-analytics") {
// Add random delay of 0-90 minutes to prevent API flooding
const randomDelayMinutes = Math.floor(Math.random() * 91); // 0-90 minutes
const randomDelayMs = randomDelayMinutes * 60 * 1000;
logger.info(`[Scheduler] Analytics job will execute in ${randomDelayMinutes} minutes (${new Date(Date.now() + randomDelayMs).toISOString()})`);
await new Promise(resolve => setTimeout(resolve, randomDelayMs));
logger.info(
`[Scheduler] Analytics job will execute in ${randomDelayMinutes} minutes (${new Date(Date.now() + randomDelayMs).toISOString()})`
);
await new Promise((resolve) => setTimeout(resolve, randomDelayMs));
await this.triggerJobAnalysis();
}
} catch (error) {
@@ -101,7 +104,7 @@ export class DailyS3Scheduler {
// Add repeatable jobs (cron-like scheduling)
// Only one instance across all workers will execute these at the scheduled time
// Daily S3 sync at 1 AM PST
await this.schedulerQueue.add(
"daily-s3-sync",
@@ -129,14 +132,15 @@ export class DailyS3Scheduler {
);
this.isInitialized = true;
logger.info(`[Scheduler] Daily scheduler started using BullMQ (Worker ${process.env.NODE_APP_INSTANCE || "N/A"})`);
logger.info(
`[Scheduler] Daily scheduler started using BullMQ (Worker ${process.env.NODE_APP_INSTANCE || "N/A"})`
);
// Log next scheduled runs
const status = await this.getStatus();
status.nextRun.forEach(task => {
status.nextRun.forEach((task) => {
logger.info(`[Scheduler] ${task.name} - Next run: ${task.nextRun}`);
});
} catch (error) {
logger.error("[Scheduler] Failed to start scheduler:", error);
throw error;
@@ -234,8 +238,8 @@ export class DailyS3Scheduler {
try {
const repeatableJobs = await this.schedulerQueue.getRepeatableJobs();
return repeatableJobs.map(job => ({
return repeatableJobs.map((job) => ({
name: job.name || job.id || "unknown",
nextRun: job.next ? new Date(job.next) : null,
status: "scheduled"

View File

@@ -353,7 +353,7 @@ async function getDirectoryStats(
if (stat.isDirectory()) {
// Skip thumbs and ConvertedOriginals folders (case-insensitive)
const itemLower = item.toLowerCase();
if (itemLower === "thumbs" || itemLower === "convertedoriginals") {
if (itemLower === "thumbs" || itemLower === "convertedoriginal" || itemLower === "bills") {
continue;
}