Skip to content

Calling Janitor:Destroy() does not always work #40

@MiaGobble

Description

@MiaGobble

This is a critical issue that keeps me from completely relying on this library.

Consider this code snippet:

local This = Janitor.new()

This:Add(RunService.Heartbeat:Connect(function()
	--...
end))

This:Add(function()
	--...
end)

This:Destroy()

In this example, there is a chance that nothing in the janitor is cleaned up when I call Destroy(). This means the connections aren't cleaned up, functions aren't called, etc. Swapping to an equivalent library, such as Maid, fixes this issue.

This seems to happen more if I attempt to destroy the janitor within a second or less of creating it.

Again, this is a critical issue, and keeps happening for me in important situations. I can't rely on this library until this is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions