small fixes
This commit is contained in:
parent
875296922e
commit
9413d6588d
4 changed files with 24 additions and 3 deletions
|
|
@ -147,16 +147,28 @@ async function initializeServices() {
|
||||||
...(scheduledJob.payload || {}),
|
...(scheduledJob.payload || {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Build job options from scheduled job config
|
||||||
|
const jobOptions = {
|
||||||
|
priority: scheduledJob.priority,
|
||||||
|
delay: scheduledJob.delay,
|
||||||
|
repeat: {
|
||||||
|
immediately: scheduledJob.immediately,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
await queue.addScheduledJob(
|
await queue.addScheduledJob(
|
||||||
scheduledJob.operation,
|
scheduledJob.operation,
|
||||||
jobData,
|
jobData,
|
||||||
scheduledJob.cronPattern
|
scheduledJob.cronPattern,
|
||||||
|
jobOptions
|
||||||
);
|
);
|
||||||
totalScheduledJobs++;
|
totalScheduledJobs++;
|
||||||
logger.info('Scheduled job created', {
|
logger.info('Scheduled job created', {
|
||||||
handler: handlerName,
|
handler: handlerName,
|
||||||
operation: scheduledJob.operation,
|
operation: scheduledJob.operation,
|
||||||
cronPattern: scheduledJob.cronPattern
|
cronPattern: scheduledJob.cronPattern,
|
||||||
|
immediately: scheduledJob.immediately,
|
||||||
|
priority: scheduledJob.priority
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ export const webShareProvider = {
|
||||||
|
|
||||||
async function fetchProxiesFromWebShare(): Promise<string[] | null> {
|
async function fetchProxiesFromWebShare(): Promise<string[] | null> {
|
||||||
try {
|
try {
|
||||||
|
// Try environment variables first, then fall back to config
|
||||||
const apiKey = process.env.WEBSHARE_API_KEY;
|
const apiKey = process.env.WEBSHARE_API_KEY;
|
||||||
const apiUrl = process.env.WEBSHARE_API_URL;
|
const apiUrl = process.env.WEBSHARE_API_URL;
|
||||||
|
|
||||||
|
|
@ -102,6 +103,8 @@ async function fetchProxiesFromWebShare(): Promise<string[] | null> {
|
||||||
logger.error('Missing WebShare configuration', {
|
logger.error('Missing WebShare configuration', {
|
||||||
hasApiKey: !!apiKey,
|
hasApiKey: !!apiKey,
|
||||||
hasApiUrl: !!apiUrl,
|
hasApiUrl: !!apiUrl,
|
||||||
|
envApiKey: process.env.WEBSHARE_API_KEY?.substring(0, 10) + '...',
|
||||||
|
envApiUrl: process.env.WEBSHARE_API_URL,
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,5 +86,9 @@
|
||||||
"proxy": {
|
"proxy": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"webshare": {
|
||||||
|
"apiKey": "",
|
||||||
|
"apiUrl": "https://proxy.webshare.io/api/v2/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -109,6 +109,7 @@ export class Queue {
|
||||||
pattern: cronPattern,
|
pattern: cronPattern,
|
||||||
// Use job name as repeat key to prevent duplicates
|
// Use job name as repeat key to prevent duplicates
|
||||||
key: `${this.queueName}:${name}`,
|
key: `${this.queueName}:${name}`,
|
||||||
|
...options.repeat,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -116,7 +117,8 @@ export class Queue {
|
||||||
queueName: this.queueName,
|
queueName: this.queueName,
|
||||||
jobName: name,
|
jobName: name,
|
||||||
cronPattern,
|
cronPattern,
|
||||||
repeatKey: scheduledOptions.repeat?.key
|
repeatKey: scheduledOptions.repeat?.key,
|
||||||
|
immediately: scheduledOptions.repeat?.immediately
|
||||||
});
|
});
|
||||||
|
|
||||||
return await this.bullQueue.add(name, data, scheduledOptions);
|
return await this.bullQueue.add(name, data, scheduledOptions);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue