mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Read new config on the server side
This commit is contained in:
parent
a9dd442733
commit
2feaef91bd
@ -243,7 +243,7 @@ pub fn main_loop(
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
loop_turn(
|
if let Some(new_server_config) = loop_turn(
|
||||||
&pool,
|
&pool,
|
||||||
&task_sender,
|
&task_sender,
|
||||||
&libdata_sender,
|
&libdata_sender,
|
||||||
@ -251,7 +251,9 @@ pub fn main_loop(
|
|||||||
&mut world_state,
|
&mut world_state,
|
||||||
&mut loop_state,
|
&mut loop_state,
|
||||||
event,
|
event,
|
||||||
)?;
|
)? {
|
||||||
|
dbg!(new_server_config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
world_state.analysis_host.request_cancellation();
|
world_state.analysis_host.request_cancellation();
|
||||||
@ -361,7 +363,7 @@ fn loop_turn(
|
|||||||
world_state: &mut WorldState,
|
world_state: &mut WorldState,
|
||||||
loop_state: &mut LoopState,
|
loop_state: &mut LoopState,
|
||||||
event: Event,
|
event: Event,
|
||||||
) -> Result<()> {
|
) -> Result<Option<ServerConfig>> {
|
||||||
let loop_start = Instant::now();
|
let loop_start = Instant::now();
|
||||||
|
|
||||||
// NOTE: don't count blocking select! call as a loop-turn time
|
// NOTE: don't count blocking select! call as a loop-turn time
|
||||||
@ -372,6 +374,8 @@ fn loop_turn(
|
|||||||
log::info!("queued count = {}", queue_count);
|
log::info!("queued count = {}", queue_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut new_server_config = None;
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::Task(task) => {
|
Event::Task(task) => {
|
||||||
on_task(task, &connection.sender, &mut loop_state.pending_requests, world_state);
|
on_task(task, &connection.sender, &mut loop_state.pending_requests, world_state);
|
||||||
@ -401,15 +405,20 @@ fn loop_turn(
|
|||||||
on_notification(&connection.sender, world_state, loop_state, not)?;
|
on_notification(&connection.sender, world_state, loop_state, not)?;
|
||||||
}
|
}
|
||||||
Message::Response(resp) => {
|
Message::Response(resp) => {
|
||||||
if Some(&resp.id) == loop_state.configuration_request_id.as_ref() {
|
|
||||||
loop_state.configuration_request_id.take();
|
|
||||||
eprintln!("!!!!!!!!!!!!!!1");
|
|
||||||
dbg!(&resp);
|
|
||||||
}
|
|
||||||
let removed = loop_state.pending_responses.remove(&resp.id);
|
let removed = loop_state.pending_responses.remove(&resp.id);
|
||||||
if !removed {
|
if !removed {
|
||||||
log::error!("unexpected response: {:?}", resp)
|
log::error!("unexpected response: {:?}", resp)
|
||||||
}
|
}
|
||||||
|
if Some(&resp.id) == loop_state.configuration_request_id.as_ref() {
|
||||||
|
loop_state.configuration_request_id.take();
|
||||||
|
let new_config =
|
||||||
|
serde_json::from_value::<Vec<ServerConfig>>(resp.result.unwrap())
|
||||||
|
.unwrap()
|
||||||
|
.first()
|
||||||
|
.unwrap()
|
||||||
|
.to_owned();
|
||||||
|
new_server_config = Some(new_config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -479,7 +488,7 @@ fn loop_turn(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(new_server_config)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_task(
|
fn on_task(
|
||||||
|
Loading…
Reference in New Issue
Block a user