From 54565aeccffb0722de554820eb856b23ac3c004f Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 12 May 2017 20:13:50 +0200 Subject: fix update subscribe inf loop --- api.js | 1 + commands/vainsocial/me.js | 4 +--- views/register.js | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api.js b/api.js index 0fe9e78..66d52da 100644 --- a/api.js +++ b/api.js @@ -170,6 +170,7 @@ module.exports.subscribeUpdates = (name, timeout=UPDATE_TIMEOUT) => { } }; } if (msg == Channel.DONE) { + subscribed = false; subscription.unsubscribe(); return undefined; } diff --git a/commands/vainsocial/me.js b/commands/vainsocial/me.js index de87b4c..8679a65 100644 --- a/commands/vainsocial/me.js +++ b/commands/vainsocial/me.js @@ -35,10 +35,8 @@ Store your in game name for quicker access to other commands and for Guild manag async run(msg, args) { util.trackAction(msg, "vainsocial-me", args.name); const registerView = new RegisterView(msg, args.name); - await api.upsearchPlayer(args.name); try { - const waiter = api.subscribeUpdates(args.name); - while (await waiter.next() != "stats_update"); + await api.upsearchPlayerSync(args.name); await api.setUser(msg.author.id, args.name); } catch (err) { console.log(err); diff --git a/views/register.js b/views/register.js index b744bd1..a636e84 100644 --- a/views/register.js +++ b/views/register.js @@ -4,6 +4,7 @@ const emoji = require("discord-emoji"), View = require("./view"), + PlayerView = require("./player"), util = require("../util"), api = require("../api"), strings = require("../strings"), -- cgit v1.3.1