Closed stuebinm closed 4 months ago
@antoine-de
It might be nice to add 2 tests using this feature (one starting a server and getting an error, and one validating a file)
hm, i am not sure how to write such a test that depends on a certain feature being not set? (if i add #[cfg(not(feature="daemon"))]
to a test, it won't be run at all if default features are enabled, so it seems a little easy to miss it since it usually probably won't be run at all)
yes, you're right, we also need to add cargo test --no-default-features
to make sure they will be run 👍
I can do this part if you prefer.
what's the current state on this? anything i can do to help it along?
what's the current state on this? anything i can do to help it along?
The changes do seem safe for our use on transport.data.gouv.fr (daemon mode). In case we face anything weird, we will come back and open an issue (and we can always deploy a previous commit as a hot-fix if needed).
This allows compiling the validator without support for the server/daemon mode by doing
cargo build --no-default-features
for users who don't intend to run the validator as a service but only want to check e.g. a few local files.This greatly saves on compile times and binary size (as rough numbers: on my machine I end up with 141 MiB vs 47 MiB for debug builds with and without daemon mode, and 8 MiB vs 3.2 MiB for release builds. Compile times in release mode are less then half without daemon mode, from 1min 23s to just 27s).