Skip to content

Memory leak with priorities #63

@nmargaritis

Description

@nmargaritis

Hi there,

It appears that the priorities implementation is leaking.

Whenever a taskid (autogenerated or custom) is added to queue._store._priorities, it never gets deleted. So as long as tasks are added to a prioritised queue, the queue is leaking few bytes at a time. Depending on the tasks frequency you might start leaking MBs in few minutes to hours.

So practically the problem is that the priorities are not cleared for finished or failed tasks.

Currently the workaround we have applied is related with manually deleting the task ids, whenever task_finish or task_failed are triggered with the respective id.

         this.mainQueue.on('task_finish', taskId => {
            delete this.mainQueue._store._priorities[taskId];
        });

        this.mainQueue.on('task_failed', (taskId, err) => {
            if (err) {
                console.error(err);
            } else {
                delete this.mainQueue._store._priorities[taskId];
            }
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions