MCPcopy
hub / github.com/scality/cloudserver / _healthCheck

Method _healthCheck

lib/utilization/scuba/wrapper.js:29–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27 }
28
29 _healthCheck() {
30 return this.healthCheck().then(data => {
31 if (data?.date) {
32 const date = new Date(data.date);
33 if (Date.now() - date.getTime() > this.maxStaleness) {
34 throw new Error('Data is stale, disabling quotas');
35 }
36 }
37 if (!this.enabled) {
38 this._log.info('Scuba health check passed, enabling quotas');
39 }
40 monitoring.utilizationServiceAvailable.set(1);
41 this.enabled = true;
42 }).catch(err => {
43 if (this.enabled) {
44 this._log.warn('Scuba health check failed, disabling quotas', {
45 err: err.name,
46 description: err.message,
47 });
48 }
49 monitoring.utilizationServiceAvailable.set(0);
50 this.enabled = false;
51 });
52 }
53
54 periodicHealthCheck() {
55 if (this._healthCheckTimer) {

Callers 2

periodicHealthCheckMethod · 0.95
wrapper.jsFile · 0.80

Calls 2

infoMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected