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

View File

@@ -3223,6 +3223,7 @@ speechSynthesis.getVoices();
userId: content.userId
}
});
$app.APILastOnline.set(content.userId, Date.now());
break;
case 'friend-active':
@@ -3668,6 +3669,8 @@ speechSynthesis.getVoices();
$app.data.debug = false;
$app.data.APILastOnline = new Map();
$app.data.sharedFeed = {
gameLog: {
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);
if (typeof ctx === 'undefined') {
return;
@@ -5004,8 +5007,14 @@ speechSynthesis.getVoices();
});
}
} else {
if (ctx.state === 'online' && ref.state === 'active' && state === 'active') {
return;
if (ctx.state === 'online' && state === 'active') {
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.isVIP) {