nodejs-health-checker
Version:
Simple Nodejs package to simplify applications based in Node, to trace the healthy of the pods
30 lines • 851 B
JavaScript
/**
* Perform a memcache instance config and call to check
* if the service is available
* @param config IntegrationConfig
* @returns Promise<HTTPChecker>
*/
export async function checkMemcachedClient(config) {
let client;
try {
// lazy loading memcache package to enable peer dependency to be optional
const { default: Memcache } = await import("memcache");
client = new Memcache({
nodes: [config.host],
timeout: config.timeout,
keepAlive: false,
});
await client.connect();
const result = await client.stats();
return { status: !!result };
}
catch (error) {
return { status: false, error };
}
finally {
if (client) {
client.disconnect();
}
}
}
//# sourceMappingURL=memcache-service.js.map