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

Defer user logout on HIT submission #81

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion server/connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,14 @@ Meteor.methods({
if ((token = Accounts._getLoginToken(this.connection.id))) {
// This $pulls tokens from services.resume.loginTokens, and should work
// in the same way that Accounts._expireTokens effects cleanup.
Accounts.destroyToken(userId, token);
//
// We run this in a deferred function so that the login credential update
// doesn't hit the write fence on this method call, making it less
// likely for the client to get logged out (and see an error) before
// the HIT actually submits. This should fix, or at least improve, the
// race condition causing
// https://github.com/TurkServer/turkserver-meteor/issues/28
Meteor.setTimeout(() => Accounts.destroyToken(userId, token), 1000);
}

// return true to auto submit the HIT
Expand Down