#Manual task not triggering

1 messages · Page 1 of 1 (latest)

real geyser
#

im trying to create an unmute task but it doesnt seems to get triggered that reliably
I also tried copy pasting the documentation code for manual and it also gets triggered rarely

here are some snippets of my code

UnmuteUserTask.ts

https://raw.githubusercontent.com/TheOreoTM/cardinal-bot/main/src/scheduled-tasks/UnmuteMemberTask.ts

And i call it in a Class i have named Modlog

Modlog.ts

export class Modlog {
// code
public async createMute(data: MuteCreateInput) {
        const mute = await container.db.mute.create({
            data: {
                expiresAt: data.expiresAt,
                memberId: this.memberId,
                removedRoles: data.removedRoles ? data.removedRoles : [],
                modlog: {
                    create: await this.createModlog()
                }
            }
        });

        if (data.expiresAt) {
            const offset = data.expiresAt.getTime() - Date.now();
            console.log(offset);
            container.tasks.create('UnmuteMemberTask', { muteId: mute.id }, offset);
        }

        await this.sendModlog(mute.modlogId);

        return this;
    }
// code 
}

and this class is called in the mute command

Here my are versions
"@sapphire/plugin-scheduled-tasks": "^8.0.0"
"@sapphire/framework": "^4.5.1"

#

What am i doing wrong?

#

i have also setup listeners for ScheduledTasksEvents.TaskRun and TaskNotFound

And none of them were helpful

#

Here is a ss of the logs

#

and the only occurence when the task actually ran

#

the not found expireMute is my old scheduled task that was on an interval and i had it disabled

tidal wing
#

fraid this will be on the bullmq package as the plugin is merely a tiny wrapper around it so you'll have to ask for support at wherever you can get bullmq support.

glossy panther
#

Not sure how much it would help but container.tasks.create is async, try throwing an await in front.

real geyser
#

hm ok

real geyser
#

Also can you inform me on what removeOnComplete does exactly?

#

and where would i use it