diff --git a/command.go b/command.go
index <HASH>..<HASH> 100644
--- a/command.go
+++ b/command.go
@@ -1269,7 +1269,7 @@ func SetCommandBufferPool(poolSize, initBufSize, maxBufferSize int) {
 	panic("There is no need to optimize the buffer pool anymore. Buffers have moved to Connection object.")
 }
 
-func (cmd *baseCommand) execute(ifc command) (err error) {
+func (cmd *baseCommand) execute(ifc command) error {
 	policy := ifc.getPolicy(ifc).GetBasePolicy()
 	iterations := -1
 
@@ -1279,6 +1279,11 @@ func (cmd *baseCommand) execute(ifc command) (err error) {
 	// set timeout outside the loop
 	deadline := time.Now().Add(policy.Timeout)
 
+	socketTimeout, err := policy.socketTimeout()
+	if err != nil {
+		return err
+	}
+
 	// Execute command until successful, timed out or maximum iterations have been reached.
 	for {
 		// too many retries
@@ -1306,11 +1311,6 @@ func (cmd *baseCommand) execute(ifc command) (err error) {
 			continue
 		}
 
-		socketTimeout, err := policy.socketTimeout()
-		if err != nil {
-			return err
-		}
-
 		cmd.conn, err = ifc.getConnection(socketTimeout)
 		if err != nil {
 			Logger.Warn("Node " + cmd.node.String() + ": " + err.Error())
Get socket timeout once per command execution, do not redefine err var in command execution loop