Skip to content

Commit

Permalink
Changed the waiting time.
Browse files Browse the repository at this point in the history
  • Loading branch information
tzurE committed Dec 11, 2017
1 parent d380cdf commit 12703c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion remote/mounter/block_device_utils/mpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (b *blockDeviceUtils) GetWwnByScsiInq(dev string) (string, error) {
args := []string{"-p", "0x83", dev}
// add timeout in case the call never comes back.
b.logger.Debug(fmt.Sprintf("Calling [%s] with timeout",sgInqCmd ))
outputBytes, err := b.exec.ExecuteWithTimeout(1000, sgInqCmd, args)
outputBytes, err := b.exec.ExecuteWithTimeout(3000, sgInqCmd, args)
if err != nil {
return "", b.logger.ErrorRet(&commandExecuteError{sgInqCmd, err}, "failed")
}
Expand Down
6 changes: 3 additions & 3 deletions utils/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (e *executor) Execute(command string, args []string) ([]byte, error) {
func (e *executor) ExecuteWithTimeout(mSeconds int ,command string, args []string) ([]byte, error) {

// Create a new context and add a timeout to it
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(mSeconds)*time.Millisecond)
defer cancel() // The cancel should be deferred so resources are cleaned up

// Create the command with our context
Expand All @@ -89,7 +89,7 @@ func (e *executor) ExecuteWithTimeout(mSeconds int ,command string, args []strin
// happens when a process is killed.
if ctx.Err() == context.DeadlineExceeded {
e.logger.Debug(fmt.Sprintf("Command %s timeout reached", command))
return ctx.Err()
return nil, ctx.Err()
}

// If there's no context error, we know the command completed (or errored).
Expand All @@ -98,7 +98,7 @@ func (e *executor) ExecuteWithTimeout(mSeconds int ,command string, args []strin
e.logger.Debug(fmt.Sprintf("Non-zero exit code:", err))
}

return string(out), err
return out, err
}

func (e *executor) Stat(path string) (os.FileInfo, error) {
Expand Down

0 comments on commit 12703c5

Please sign in to comment.