Skip to content

Commit

Permalink
Prepare query again when expired from the server
Browse files Browse the repository at this point in the history
  • Loading branch information
suguru committed Nov 20, 2013
1 parent c83b07f commit 98b840f
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit 98b840f

Please sign in to comment.