mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 21:01:45 +03:00
cleanup
This commit is contained in:
parent
48ec709c1a
commit
30e4d76808
@ -21,7 +21,7 @@ before_script:
|
||||
- sudo apt-get install -y postgresql-9.6-postgis-2.4
|
||||
- psql -U postgres -c 'create database test'
|
||||
- psql -U postgres -d test -c 'create extension postgis'
|
||||
- psql -U postgres -d test -f tests/fixtures/points.sql
|
||||
# - psql -U postgres -d test -f tests/fixtures/points.sql
|
||||
|
||||
script:
|
||||
- cargo test --verbose --all
|
||||
|
13
src/main.rs
13
src/main.rs
@ -17,8 +17,6 @@ use actix::{Actor, Addr, Syn, SyncArbiter};
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
mod db;
|
||||
mod utils;
|
||||
@ -78,19 +76,10 @@ fn main() {
|
||||
let port = 3000;
|
||||
let bind_addr = format!("0.0.0.0:{}", port);
|
||||
let _addr = HttpServer::new(move || {
|
||||
let sources_rc = Rc::new(RefCell::new(sources.clone()));
|
||||
|
||||
let worker_actor = worker_actor::WorkerActor {
|
||||
sources: sources_rc.clone(),
|
||||
};
|
||||
|
||||
let worker_addr: Addr<Syn, _> = worker_actor.start();
|
||||
coordinator_addr.do_send(messages::Connect { addr: worker_addr });
|
||||
|
||||
martin::new(
|
||||
db_sync_arbiter.clone(),
|
||||
coordinator_addr.clone(),
|
||||
sources_rc.clone(),
|
||||
sources.clone(),
|
||||
)
|
||||
}).bind(bind_addr.clone())
|
||||
.expect(&format!("Can't bind to {}", bind_addr))
|
||||
|
@ -8,6 +8,7 @@ use std::rc::Rc;
|
||||
use super::messages;
|
||||
use super::db::DbExecutor;
|
||||
use super::source::Sources;
|
||||
use super::worker_actor::WorkerActor;
|
||||
use super::coordinator_actor::CoordinatorActor;
|
||||
|
||||
pub struct State {
|
||||
@ -107,11 +108,20 @@ fn tile(req: HttpRequest<State>) -> Result<Box<Future<Item = HttpResponse, Error
|
||||
pub fn new(
|
||||
db_sync_arbiter: Addr<Syn, DbExecutor>,
|
||||
coordinator_addr: Addr<Syn, CoordinatorActor>,
|
||||
sources: Rc<RefCell<Sources>>,
|
||||
sources: Sources,
|
||||
) -> Application<State> {
|
||||
let sources_rc = Rc::new(RefCell::new(sources));
|
||||
|
||||
let worker_actor = WorkerActor {
|
||||
sources: sources_rc.clone(),
|
||||
};
|
||||
|
||||
let worker_addr: Addr<Syn, _> = worker_actor.start();
|
||||
coordinator_addr.do_send(messages::Connect { addr: worker_addr });
|
||||
|
||||
let state = State {
|
||||
db: db_sync_arbiter,
|
||||
sources: sources.clone(),
|
||||
sources: sources_rc.clone(),
|
||||
coordinator_addr: coordinator_addr,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user