Skip to content

Commit

Permalink
Update MemcachedSessionService.java
Browse files Browse the repository at this point in the history
Fix issue magro#404
  • Loading branch information
RDiazR2 committed Feb 13, 2019
1 parent 716e147 commit f76942b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -951,11 +951,17 @@ private MemcachedBackupSession loadBackupSession( @Nonnull final String requeste
// if we didn't find the backup in the next node, let's go through other nodes
// to see if the backup is there. For this we have to fake the session id so that
// the SuffixBasedNodeLocator selects another backup node.

// to make sure the list is iterated only once, it's iterated less than primary node list size
int maxNodes = _memcachedNodesManager.getPrimaryNodeIds().size();
int count=1; // while starts if first loadBackupSession has failed
while(result == null
&& (nextNodeId = _memcachedNodesManager.getNextAvailableNodeId(nextNodeId)) != null
&& !nextNodeId.equals(nodeId)) {
&& !nextNodeId.equals(nodeId)
&& count < maxNodes) {
final String newSessionId = getSessionIdFormat().createNewSessionId(requestedSessionId, nextNodeId);
result = loadBackupSession(newSessionId, newNodeId);
count++;
}

if ( result == null ) {
Expand Down

0 comments on commit f76942b

Please sign in to comment.