Official Discord: https://discord.gg/NWpN5mmg3x | Powerful web framework for Rust | https://github.com/actix/actix-web/wiki/FAQ
robjtede on master
tweak migration document (compare)
github-actions[bot] on gh-pages
Deploying to gh-pages from @ 5… (compare)
github-actions[bot] on gh-pages
Deploying to gh-pages from @ f… (compare)
robjtede on test-v0.1.0-beta.13
robjtede on http-test-v3.0.0-beta.13
robjtede on master
prepare actix-http-test release… prepare actix-test release 0.1.… (compare)
github-actions[bot] on gh-pages
Deploying to gh-pages from @ a… (compare)
robjtede on actors-v4.0.0-beta.12
robjtede on master
prepare actix-web-actors releas… (compare)
robjtede on awc-v3.0.0-beta.21
robjtede on master
prepare awc release 3.0.0-beta.… (compare)
robjtede on http-v3.0.0-rc.3
robjtede on master
prepare actix-http release 3.0.… (compare)
I'm having some issue with redis
integration. A redis::Connection
needs to be mutable in order to write something (in my case, a queue with XADD
). So I have to use a RwLock
for the redis connection in my app_data
and it slows down the API a lot:
Since the Connection is a Pin<Box<>>
I thought I could also clone it but it doesn't seem to work.
How do other people handle redis connections using actix?
fn call(&self, req: S::Request) -> Self::Future {
TimeoutServiceResponse {
fut: self.service.call(req),
sleep: Sleep::new(clock::now() + self.timeout),
}
}
Request
not found"
call
method should be of type Req
, not of type S::Request
HttpServer.run()
only resolves when we shutdown the webserver.HttpServer::run
cannot be called from a tokio::task::spawn
.#[actix_web::main]
was doing some magic.
std::thread::spawn(move || {
actix_web::rt::System::new().block_on(async move {
...
})
})
Consider an endpoint for post requests via post macro (https://docs.rs/actix-web/3.3.2/actix_web/attr.post.html). For example using #[post("/login")]
.
Is it possible to define the path elsewhere like const LOGIN: &str = "/login"
and use it in the post macro? I would like to collect all endpoints at one place.
I couldn't make it work. I tried #[post(LOGIN)]
and #[post("{}", LOGIN)]
as well as #[post("{LOGIN}")]
but without success.
Cheers
Hi everyone!
I'm getting thread panic in runtime after upgrading actix from 0.10 to either 0.11 or 0.12 with
thread 'main' panicked at '`spawn_local` called from outside of a `task::LocalSet`', /Users/stepan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.12.0/src/task/local.rs:305:18
The only change I've made to my code is that I've removed the name argument from the actix::System::new
:
let sys = actix::System::new();
let db = SyncArbiter::start(3, move || DbActor(pool.clone()));
let coordinator: Addr<_> = CoordinatorActor::default().start();
HttpServer::new(move || {
let state = create_state(db.clone(), coordinator.clone(), config.clone());
let cors_middleware = Cors::default().allow_any_origin();
App::new()
.data(state)
.wrap(cors_middleware)
.wrap(middleware::NormalizePath::new(
middleware::normalize::TrailingSlash::MergeOnly,
))
.wrap(middleware::Logger::default())
.wrap(middleware::Compress::default())
.configure(router)
})
.bind(listen_addresses.clone())
.unwrap_or_else(|_| panic!("Can't bind to {}", listen_addresses))
.keep_alive(keep_alive)
.shutdown_timeout(0)
.workers(worker_processes)
.run();
sys.run()
My current dependencies are
actix = "0.12"
actix-cors = "0.5.4"
actix-rt = "1.1"
actix-web = "3.3.2"
What am I missing?
http v0.2.5
. It would now be Rust 1.46. If you want to keep the old MSRV 1.42 it should be as easy as adding an exact dep in your Cargo.toml: http = "=0.2.4"
.
tokio::fs::File
but that's because i implemented AsyncRead, AsyncWrite, and AsyncSeek on a wrapper of tokio_uring::fs::File
and reading and writing copies all the bytes around
Stream<Item = Bytes>
on tokio_uring::fs::File could work, since you could read directly into a Vec<u8>
which you can magic into a Bytes
at little cost