Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autokick/Goko race condition #216

Open
aiannacc opened this issue May 1, 2014 · 0 comments
Open

autokick/Goko race condition #216

aiannacc opened this issue May 1, 2014 · 0 comments

Comments

@aiannacc
Copy link
Owner

aiannacc commented May 1, 2014

I haven't been able to reproduce this problem on my own. This is speculation based on a bug report from hvb: http://forum.dominionstrategy.com/index.php?topic=8163.msg373261#msg373261

This is the offending line:

https://github.com/aiannacc/Goko-Salvager/blob/master/src/ext/autokick.js#L33

The problem is that Goko's mtgRoom.helpers.RatingHelper._rankingsCached object sometimes doesn't get populated quickly enough. If an opponent joins your game before it does, you get an exception that interferes with the ordinary Goko client functionality.

Probably we need to check if the cache is available and run the async queries to request the joiner's Goko Pro rating if it isn't. I really hate writing and reading that sort of callback spaghetti, but it's not quite so horrible if we implement it with JS Promises.

Note that Goko has its own proprietary Promise-like API. Most of the queries called on a FS.Connection object generate these FunSockets "Promise" objects. It's worse, than the official JS Promise API though... you can't chain then() or except() methods and there are some other gotchas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant