-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Retry exec commands on text file busy #763
Retry exec commands on text file busy #763
Conversation
As was mentioned in the discussion above, can you move this logic to RawExec (good point, @mars1024). Then we can get this in. |
ab19ddf
to
dbed933
Compare
dbed933
to
2541e81
Compare
This makes the plugin validation a bit more robust by retrying the execution if the plugin is in text file busy state. This can happen if we write the config and the plugin at once. To avoid such races we now try up to 5 seconds for the plugin validation. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2541e81
to
e2a7366
Compare
// Retry the command on "text file busy" errors | ||
for i := 0; i <= 5; i++ { | ||
err := c.Run() | ||
|
||
// Command succeeded | ||
if err == nil { | ||
break | ||
} | ||
|
||
// If the plugin is currently about to be written, then we wait a | ||
// second and try it again | ||
if strings.Contains(err.Error(), "text file busy") { | ||
time.Sleep(time.Second) | ||
continue | ||
} | ||
|
||
// All other errors except than the busy text file | ||
return nil, e.pluginErr(err, stdout.Bytes(), stderr.Bytes()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcbw I moved the logic over here, should me make it configurable somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
This makes the plugin validation a bit more robust by retrying the
execution if the plugin is in text file busy state. This can happen if
we write the config and the plugin at once. To avoid such races we now
try up to 5 seconds for the plugin validation.