Skip to content

Commit

Permalink
actix-web 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dejankos committed Sep 12, 2020
1 parent 4062679 commit 87dc338
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ description = "RocksDb as a service with support for multiple databases and reco

[dependencies]
structopt = "0.3"
actix-web = "2.0"
actix-rt = "1.0"
actix-web-prom = "0.2"
actix-web = "3"
actix-web-prom = "0.3.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
simplelog = "0.7.6"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ $ cargo test -- --test-threads=1


### TODO
- [ ] support for more rocksDb options in config (bloom, block cache..)
- [X] actix-web 3.0 - fixed mem leak
- [X] channel for expire
- [ ] support for more rocksDb options in config (bloom, block cache..)
- [ ] fix running test in parallel (TODO per test db root path)
- [ ] db iterator for on startup init
- [ ] test compaction
Expand Down
2 changes: 2 additions & 0 deletions src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use actix_web::{test, web, App, Error};

use crate::config::{DbConfig, RocksDbConfig};
use crate::conversion::bytes_to_str;
use actix_web::rt as actix_rt;


use super::*;

Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async fn health() -> HttpResponse {
}

// main thread will panic! if config can't be initialized
#[actix_rt::main]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=error");
std::env::set_var("RUST_BACKTRACE", "1");
Expand All @@ -189,11 +189,11 @@ async fn main() -> std::io::Result<()> {
let db_manager = DbManager::new(db_cfg)?;
let db_manager = web::Data::new(db_manager);

let prometheus = init_prometheus();
let _prometheus = init_prometheus();
HttpServer::new(move || {
App::new()
.wrap(ErrorHandlers::new().handler(http::StatusCode::NOT_FOUND, not_found))
.wrap(prometheus.clone())
// .wrap(prometheus.clone()) // TODO waiting 3.0 upgrade
.app_data(db_manager.clone())
.service(open)
.service(close)
Expand Down

0 comments on commit 87dc338

Please sign in to comment.