Skip to content

Add health check method #74

Description

@razor-x

Add property that is updated via background polling

constseam=newSeam()seam.isHealthy// boolean

Allow configuring behavior

constseam=newSeam({pollHealth: true})seam.isHealthy// false// first health check happens right away, but needs to wait for at least next tick to updateawaitsleep(500)seam.isHealthy// true```tsconstseam=newSeam({pollHealth: {pollingInterval: 1000,timeout: 5000,// timeout error will set isHealthy falseonError: (err: Error)=>{console.log(err)}},})seam.isHealthy// falseawaitsleep(500)seam.isHealthy// true
constseam=newSeam({pollHealth: false})seam.isHealthy// falseawaitseam.updateHealth()seam.isHealthy// true

By default, { pollHealth: false }.
The seam.isHealthy property should be implemented as a getter and will start false. It should throw if accessed but { pollingInterval: false } or seam.updateHealth was not called at least once.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions