Attempt 2 at instance timers, API incorrectly reporting users as active

trash fix for a trash bug
This commit is contained in:
Natsumi
2021-03-30 00:34:22 +13:00
parent 1071af14d9
commit c165f8112e
+12 -3
View File
@@ -3223,6 +3223,7 @@ speechSynthesis.getVoices();
userId: content.userId userId: content.userId
} }
}); });
$app.APILastOnline.set(content.userId, Date.now());
break; break;
case 'friend-active': case 'friend-active':
@@ -3668,6 +3669,8 @@ speechSynthesis.getVoices();
$app.data.debug = false; $app.data.debug = false;
$app.data.APILastOnline = new Map();
$app.data.sharedFeed = { $app.data.sharedFeed = {
gameLog: { gameLog: {
wrist: [], wrist: [],
@@ -4928,7 +4931,7 @@ speechSynthesis.getVoices();
} }
}; };
$app.methods.updateFriend = function (id, state, origin) { $app.methods.updateFriend = async function (id, state, origin) {
var ctx = this.friends.get(id); var ctx = this.friends.get(id);
if (typeof ctx === 'undefined') { if (typeof ctx === 'undefined') {
return; return;
@@ -5004,8 +5007,14 @@ speechSynthesis.getVoices();
}); });
} }
} else { } else {
if (ctx.state === 'online' && ref.state === 'active' && state === 'active') { if (ctx.state === 'online' && state === 'active') {
return; await new Promise(resolve => setTimeout(resolve, 50000));
if (this.APILastOnline.has(id)) {
var date = this.APILastOnline.get(id);
if (date > Date.now() - 60000) {
return;
}
}
} }
if (ctx.state === 'online') { if (ctx.state === 'online') {
if (ctx.isVIP) { if (ctx.isVIP) {