Skip to content

Revisit how sources are closed #6

@sethfitz

Description

@sethfitz

(From #5)

tilelive modules may load sources once and "cache" them internally. This means that references are being held to sources that may be closed when evicted from the source cache. (This is a more macro version of the case for which I introduced closeDelay, where references are being actively used (for long-running render tasks, e.g.) at the same approximate time that they're evicted.)

2 ideas come to mind to more generally address the issue (and eliminate the closeDelay timeout):

  1. adopt pool semantics (of unlimited size), where sources are acquired and released. That way we'll know when all references have been accounted for and sources can be closed. This would require changes to the tilelive API though.
  2. define a set of "cache lifecycle" events, adopting the open and close events that are emitted by some tilelive sources. This would require that clients reload sources when they're closed, which would require changes to anything that makes a tilelive.load() call.

(1) feels cleaner, though an approach that minimizes API changes is necessary.

/cc @garnertb

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