mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Remove web dependency on VfsSession and friends, use Instant for timing instead
This commit is contained in:
parent
20ccb2b0c4
commit
1d84c8013e
2 changed files with 6 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process;
|
use std::process;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::time::Instant;
|
||||||
|
|
||||||
use rand;
|
use rand;
|
||||||
|
|
||||||
|
|
@ -87,5 +87,5 @@ pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) {
|
||||||
|
|
||||||
println!("Server listening on port {}", web_config.port);
|
println!("Server listening on port {}", web_config.port);
|
||||||
|
|
||||||
web::start(web_config, project.clone(), &PLUGIN_CHAIN, vfs.clone());
|
web::start(web_config, project.clone(), Instant::now());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
use std::time::Instant;
|
||||||
|
|
||||||
use rouille;
|
use rouille;
|
||||||
|
|
||||||
use project::Project;
|
use project::Project;
|
||||||
use vfs::{VfsSession};
|
|
||||||
use middleware::MiddlewareChain;
|
|
||||||
use web_util::json;
|
use web_util::json;
|
||||||
|
|
||||||
/// The set of configuration the web server needs to start.
|
/// The set of configuration the web server needs to start.
|
||||||
|
|
@ -25,7 +24,7 @@ struct ServerInfo<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start the Rojo web server and park our current thread.
|
/// Start the Rojo web server and park our current thread.
|
||||||
pub fn start(config: WebConfig, project: Project, _middleware_chain: &'static MiddlewareChain, vfs: Arc<Mutex<VfsSession>>) {
|
pub fn start(config: WebConfig, project: Project, start_time: Instant) {
|
||||||
let address = format!("localhost:{}", config.port);
|
let address = format!("localhost:{}", config.port);
|
||||||
|
|
||||||
let server_id = config.server_id.to_string();
|
let server_id = config.server_id.to_string();
|
||||||
|
|
@ -36,9 +35,9 @@ pub fn start(config: WebConfig, project: Project, _middleware_chain: &'static Mi
|
||||||
// Get a summary of information about the server.
|
// Get a summary of information about the server.
|
||||||
|
|
||||||
let current_time = {
|
let current_time = {
|
||||||
let vfs = vfs.lock().unwrap();
|
let elapsed = start_time.elapsed();
|
||||||
|
|
||||||
vfs.current_time()
|
elapsed.as_secs() as f64 + elapsed.subsec_nanos() as f64 / 1_000_000_000.0
|
||||||
};
|
};
|
||||||
|
|
||||||
json(ServerInfo {
|
json(ServerInfo {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue