-
Notifications
You must be signed in to change notification settings - Fork 73
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
No need to write address twice #331
base: main
Are you sure you want to change the base?
Conversation
Optimize code Signed-off-by: jokemanfire <[email protected]>
@@ -260,8 +260,7 @@ pub async fn spawn(opts: StartOpts, grouping: &str, vars: Vec<(&str, &str)>) -> | |||
return Err(e); | |||
}; | |||
} | |||
if let Ok(()) = wait_socket_working(&address, 5, 200).await { | |||
write_str_to_file("address", &address).await?; | |||
if wait_socket_working(&address, 5, 200).await.is_ok() { |
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.
Where is the first write?
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.
while the service's start_shim call spawn , if the spawn return ok ,will write address again.
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.
@jokemanfire this isn't the same as writing it to the std_out. This is writing it to the oci bundle path as a file. I believe this is required so that if containerd restarts it knows how to reconnect to the shim:
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 @jsturtevant , I know the socket address will be written but I feel confuse about this rshim
let vars: Vec<(&str, &str)> = vec![("THP_DISABLED", thp_disabled.as_str())];
let address = spawn(opts, &grouping, vars).await?;
write_str_to_file("address", &address).await?;
also write address to address's file again .
but the func spawn return type is ok.
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.
I'm seeing two times "false" written to my container logs?
Optimize code