@@ -950,9 +950,14 @@ impl super::Nexus {
950
950
} ,
951
951
)
952
952
. await
953
- . map ( |res| res. into_inner ( ) . updated_runtime . map ( Into :: into) )
953
+ . map ( |res| res. into_inner ( ) )
954
+ . map ( |res| {
955
+ (
956
+ res. updated_runtime . map ( Into :: into) ,
957
+ res. expect_callback_in_seconds ,
958
+ )
959
+ } )
954
960
. map_err ( |e| SledAgentInstancePutError ( e) ) ;
955
-
956
961
// If the operation succeeded, write the instance state back,
957
962
// returning any subsequent errors that occurred during that
958
963
// write.
@@ -965,14 +970,8 @@ impl super::Nexus {
965
970
// (We later asynchronously receive a cpapi call that invokes
966
971
// write_returned_instance_state with the outcome.)
967
972
match instance_put_result {
968
- Ok ( state) => {
969
- if state. is_none ( )
970
- && matches ! (
971
- requested,
972
- InstanceStateChangeRequest :: Run
973
- | InstanceStateChangeRequest :: Migrate ( ..)
974
- )
975
- {
973
+ Ok ( ( state, callback_timeout) ) => {
974
+ if let Some ( timeout_secs) = callback_timeout {
976
975
// TODO: This is fragile -- suppose the nexus with
977
976
// this task crashes *and* the instance creation
978
977
// happens to also hang. The new nexus won't know
@@ -991,8 +990,10 @@ impl super::Nexus {
991
990
. log
992
991
. new ( o ! ( "component" => "Instance timeout" ) ) ;
993
992
tokio:: spawn ( async move {
994
- tokio:: time:: sleep ( Duration :: from_secs ( 120 ) )
995
- . await ;
993
+ tokio:: time:: sleep ( Duration :: from_secs_f64 (
994
+ timeout_secs,
995
+ ) )
996
+ . await ;
996
997
if let Some ( db_datastore) =
997
998
db_datastore_weak. upgrade ( )
998
999
{
0 commit comments