refactor: ♻️ Fix code smell
This commit is contained in:
parent
c33a9c345e
commit
e2eeec8b97
1 changed files with 7 additions and 9 deletions
|
@ -11,14 +11,12 @@ 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");
|
||||||
|
|
||||||
await Promise.all(
|
jobNames.map(async (jobName) => {
|
||||||
jobNames.map(async (jobName) => {
|
const job: IJob = await import(`../../schedules/${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