TerminalWitchcraft / actix-ratelimit

Rate limiter framework for Actix web
MIT License
126 stars 25 forks source link

Exit gracefully if unable to connect to the Redis #20

Open chefsale opened 2 years ago

chefsale commented 2 years ago

Currently if you provide an IP address which cannot be connected to

RedisStoreActor::from(RedisStore::connect("redis://1.1.1.1")).start()

the process still continues on and requests just timeout without a response.

chefsale commented 2 years ago

It seems like it does exit once disconnected:

[2021-11-09T19:55:53Z TRACE mio::poll] deregistering handle with poller
[2021-11-09T19:55:53Z ERROR actix_ratelimit::stores::redis] Error connecting to redis: Connection timed out (os error 110)
[2021-11-09T19:55:53Z INFO  actix_ratelimit::stores::redis] Connected to redis server
[2021-11-09T19:55:53Z DEBUG actix_ratelimit::stores::redis] Incoming connection does not exists
[2021-11-09T19:55:53Z ERROR actix_ratelimit::stores::redis] could not get redis store address
Actor hanling the connection
Not Connected to the Redis DB

The problem is that it just takes too long, how can I reduce the timeout period?