small fixes

This commit is contained in:
Boki 2025-06-19 23:57:20 -04:00
parent 875296922e
commit 9413d6588d
4 changed files with 24 additions and 3 deletions

View file

@ -147,16 +147,28 @@ async function initializeServices() {
...(scheduledJob.payload || {}),
};
// Build job options from scheduled job config
const jobOptions = {
priority: scheduledJob.priority,
delay: scheduledJob.delay,
repeat: {
immediately: scheduledJob.immediately,
},
};
await queue.addScheduledJob(
scheduledJob.operation,
jobData,
scheduledJob.cronPattern
scheduledJob.cronPattern,
jobOptions
);
totalScheduledJobs++;
logger.info('Scheduled job created', {
handler: handlerName,
operation: scheduledJob.operation,
cronPattern: scheduledJob.cronPattern
cronPattern: scheduledJob.cronPattern,
immediately: scheduledJob.immediately,
priority: scheduledJob.priority
});
}
}

View file

@ -95,6 +95,7 @@ export const webShareProvider = {
async function fetchProxiesFromWebShare(): Promise<string[] | null> {
try {
// Try environment variables first, then fall back to config
const apiKey = process.env.WEBSHARE_API_KEY;
const apiUrl = process.env.WEBSHARE_API_URL;
@ -102,6 +103,8 @@ async function fetchProxiesFromWebShare(): Promise<string[] | null> {
logger.error('Missing WebShare configuration', {
hasApiKey: !!apiKey,
hasApiUrl: !!apiUrl,
envApiKey: process.env.WEBSHARE_API_KEY?.substring(0, 10) + '...',
envApiUrl: process.env.WEBSHARE_API_URL,
});
return null;
}

View file

@ -86,5 +86,9 @@
"proxy": {
"enabled": false
}
},
"webshare": {
"apiKey": "",
"apiUrl": "https://proxy.webshare.io/api/v2/"
}
}

View file

@ -109,6 +109,7 @@ export class Queue {
pattern: cronPattern,
// Use job name as repeat key to prevent duplicates
key: `${this.queueName}:${name}`,
...options.repeat,
},
};
@ -116,7 +117,8 @@ export class Queue {
queueName: this.queueName,
jobName: name,
cronPattern,
repeatKey: scheduledOptions.repeat?.key
repeatKey: scheduledOptions.repeat?.key,
immediately: scheduledOptions.repeat?.immediately
});
return await this.bullQueue.add(name, data, scheduledOptions);