Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout checks after x milliseconds #2

Open
jdelight opened this issue May 2, 2017 · 0 comments
Open

Timeout checks after x milliseconds #2

jdelight opened this issue May 2, 2017 · 0 comments

Comments

@jdelight
Copy link

jdelight commented May 2, 2017

Arguably this could be in the calling code however it might be nice to centralise it and provide a config interface.

For example, checks must run within 200ms by default but you can specify a custom timeout in the check object. Perhaps failing to run within the timeout calls the warning callback?

const postgresCheck = {
    name: 'postgres',
    check: (ok, warning, critical) => {
        pg.query.raw('SELECT version();', [])
            .then(ok)
            .catch(critical);
    },
    timeout: 500 // check needs a little longer than the default to run
};

Overall goal here is to prevent a request from waiting indefinitely if theres a problem with the check code itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant