Giter Club home page Giter Club logo

Comments (9)

fafhrd91 avatar fafhrd91 commented on May 4, 2024

it is not possible to say why it does not compile from this issue description. I need more info

from actix-web.

fafhrd91 avatar fafhrd91 commented on May 4, 2024

here is hello world example, it doesn't use signals

https://github.com/actix/actix-web/tree/master/examples/hello-world

from actix-web.

GildedHonour avatar GildedHonour commented on May 4, 2024

from https://actix.github.io/actix-web/guide/qs_3_5.html


fn main() {
    let sys = actix::System::new("signals");

    let addr = HttpServer::new(|| {
        Application::new()
            .resource("/", |r| r.h(httpcodes::HTTPOk))})
        .bind("127.0.0.1:8080").unwrap()
        .start();

    // Subscribe to unix signals
    let signals = Arbiter::system_registry().get::<ProcessSignals>();
    signals.send(Subscribe(addr.subscriber()));

    println!("Started http server: 127.0.0.1:8080");
    let _ = sys.run();
}

====>

error[E0433]: failed to resolve. Use of undeclared type or module `Arbiter`
  --> src/main.rs:94:19
   |
94 |     let signals = Arbiter::system_registry().get::<ProcessSignals>();
   |                   ^^^^^^^ Use of undeclared type or module `Arbiter`

error: aborting due to previous error

from actix-web.

GildedHonour avatar GildedHonour commented on May 4, 2024

I need signals because each time I shut down my server I then have "address is already in use" for the next 2 minutes

from actix-web.

GildedHonour avatar GildedHonour commented on May 4, 2024

how to turn off this 2 minutes feature, at least in the development ?

from actix-web.

fafhrd91 avatar fafhrd91 commented on May 4, 2024

I'll fix "address in use" later today.
for now use .keep_alive(Some(0))

let addr = HttpServer::new(|| {
        Application::new()
            .resource("/", |r| r.h(httpcodes::HTTPOk))})
        .bind("127.0.0.1:8080").unwrap()
        .keep_alive(Some(0))                     // <- add this
        .start();

from actix-web.

GildedHonour avatar GildedHonour commented on May 4, 2024

keep_alive(Some(0)) isn't working, the address is still in use after I've shut down my server

from actix-web.

fafhrd91 avatar fafhrd91 commented on May 4, 2024

ok, let me check

from actix-web.

fafhrd91 avatar fafhrd91 commented on May 4, 2024

should be fixed in 1f7aee2

I will add better fix for "address in use" a bit later. it will work without signals

from actix-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.