doxout/recluster

Documentation for return type of activeWorkers() function is invalid

ikokostya opened this issue · 0 comments

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.