refactor: ♻️ Fix code smell
This commit is contained in:
parent
e2eeec8b97
commit
7136a5bd99
1 changed files with 9 additions and 7 deletions
|
@ -11,12 +11,14 @@ export const start = async (client: Client) => {
|
||||||
const jobNames = await checkDirectory("schedules");
|
const jobNames = await checkDirectory("schedules");
|
||||||
if (!jobNames) return logger.warn("⏰ No available jobs found");
|
if (!jobNames) return logger.warn("⏰ No available jobs found");
|
||||||
|
|
||||||
jobNames.map(async (jobName) => {
|
return await Promise.all(
|
||||||
const job: IJob = await import(`../../schedules/${jobName}`);
|
jobNames.map(async (jobName) => {
|
||||||
|
const job: IJob = await import(`../../schedules/${jobName}`);
|
||||||
|
|
||||||
return schedule.scheduleJob(job.options.schedule, async () => {
|
return schedule.scheduleJob(job.options.schedule, async () => {
|
||||||
logger.verbose(`⏰ Performed the job "${jobName}"`);
|
logger.verbose(`⏰ Performed the job "${jobName}"`);
|
||||||
await job.execute(client);
|
await job.execute(client);
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue