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

Prepare query again when expired from the server #35

Merged
merged 1 commit into from
Nov 20, 2013
Merged
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: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,15 @@ Client.prototype._executeOnConnection = function (c, query, queryId, params, con
//retry the whole thing, it will get another connection
self.executeAsPrepared(query, params, consistency, options, callback);
}
else if (err && err.code === types.responseErrorCodes.unprepared) {
//Query expired at the server
//Clear the connection from prepared info and
//trying to re-prepare query
self.emit('log', 'info', 'Unprepared query "' + query + '"');
var preparedInfo = self.preparedQueries[query];
preparedInfo.removeConnectionInfo(c.indexInPool);
self.executeAsPrepared(query, params, consistency, callback);
}
else {
callback(err, result1, result2);
}
Expand Down