Kathy Fixes (#864)

* correction

* Fix timeout handling

* kathy metric init

* cleanup
trevor/deploy-relayer-funder-multi-context
Mattie Conover 2 years ago committed by GitHub
parent 42d7d7aed0
commit c34e6193df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      typescript/infra/helm/helloworld-kathy/templates/stateful-set.yaml
  2. 9
      typescript/infra/scripts/helloworld/kathy.ts
  3. 2
      typescript/utils/src/utils.ts

@ -15,6 +15,9 @@ spec:
template: template:
metadata: metadata:
labels: *metadata_labels labels: *metadata_labels
annotations:
prometheus.io/port: "9090"
prometheus.io/scrape: "true"
spec: spec:
containers: containers:
- name: helloworld-kathy - name: helloworld-kathy

@ -116,6 +116,15 @@ async function main() {
}); });
}, sendFrequency); }, sendFrequency);
// init the metrics because it can take a while for kathy to get through everything and we do not
// want the metrics to be reported as null in the meantime.
for (const { origin, destination: remote } of pairings) {
messagesSendCount.labels({ origin, remote, status: 'success' }).inc(0);
messagesSendCount.labels({ origin, remote, status: 'failure' }).inc(0);
messageSendSeconds.labels({ origin, remote }).inc(0);
messageReceiptSeconds.labels({ origin, remote }).inc(0);
}
for ( for (
// in case we are restarting kathy, keep it from always running the exact same messages first // in case we are restarting kathy, keep it from always running the exact same messages first
let currentPairingIndex = Date.now() % pairings.length; let currentPairingIndex = Date.now() % pairings.length;

@ -181,7 +181,7 @@ export function timeout<T>(
if (!timeoutMs || timeoutMs <= 0) return promise; if (!timeoutMs || timeoutMs <= 0) return promise;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
throw new Error(message); reject(new Error(message));
}, timeoutMs); }, timeoutMs);
promise.then(resolve).catch(reject); promise.then(resolve).catch(reject);
}); });

Loading…
Cancel
Save