summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-08-01 20:40:45 +0200
committerLinnea Gräf <nea@nea.moe>2024-08-01 20:40:45 +0200
commit8649eb49663ca6e680a503d0e5f09111891804b3 (patch)
tree4694a5904a0ac5bad5922b765d274631fef24d69
parent935b8f83764ae168994911d9b7b075f12a69a828 (diff)
downloadmycelium-warning-8649eb49663ca6e680a503d0e5f09111891804b3.tar.gz
mycelium-warning-8649eb49663ca6e680a503d0e5f09111891804b3.tar.bz2
mycelium-warning-8649eb49663ca6e680a503d0e5f09111891804b3.zip
Disable crashing on request failureHEAD1.3.0master
-rw-r--r--app.js42
1 files changed, 23 insertions, 19 deletions
diff --git a/app.js b/app.js
index 387d9f0..614f977 100644
--- a/app.js
+++ b/app.js
@@ -48,25 +48,29 @@ for (i in profiles) {
async function checkCollections() {
for (i in profiles) {
const p = profiles[i];
- const data = await getProfile(p);
- console.log(data);
- let collectionTotal = 0;
- for (memberid in data.members) {
- const member = data.members[memberid];
- const collectionOne = member.collection?.MYCEL;
- if (collectionOne) collectionTotal += collectionOne;
- }
- const last = lastCollection[i];
- if (last !== collectionTotal) {
- lastCollection[i] = collectionTotal;
- lastCollectionGain[i] = Date.now();
- }
- console.log("last: " + last);
- console.log("current: " + collectionTotal);
- if (Date.now() - lastCollectionGain[i] > WARN_AFTER * 1000) {
- warn(p.ping)
- .then((it) => it.json())
- .then(console.log, console.error);
+ try {
+ const data = await getProfile(p);
+ console.log(data);
+ let collectionTotal = 0;
+ for (memberid in data.members) {
+ const member = data.members[memberid];
+ const collectionOne = member.collection?.MYCEL;
+ if (collectionOne) collectionTotal += collectionOne;
+ }
+ const last = lastCollection[i];
+ if (last !== collectionTotal) {
+ lastCollection[i] = collectionTotal;
+ lastCollectionGain[i] = Date.now();
+ }
+ console.log("last: " + last);
+ console.log("current: " + collectionTotal);
+ if (Date.now() - lastCollectionGain[i] > WARN_AFTER * 1000) {
+ warn(p.ping)
+ .then((it) => it.json())
+ .then(console.log, console.error);
+ }
+ } catch (e) {
+ console.error("COULD NOTN CHECK PROFILES", e)
}
}
}