Skip to content

Documentation for return type of activeWorkers() function is invalid #44

@ikokostya

Description

@ikokostya

Now README.md says that cluster.activeWorkers() function

Returns a hash of all worker slots (0 <= WORKER_ID < N).

But actually it returns ArrayLike object, which have length property and index singnature:

interface ActiveWorkers {
    length: number;
    [index: number]: Worker | null | undefined;
}

So, if use Object.entries(activeWokers) (or similar way for iterate keys) we can get length as key and this is unexpected behavior, because length is not a worker id.

I think documentation should be more clear in this place.

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