From 2c728b16a600124167956e56751a68475b96114b Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Wed, 3 Jan 2024 20:15:04 +0100 Subject: [PATCH 1/4] Bump clap to v4 Also bumps MSRV due to clap Replaces, and thus closes #34 --- .github/workflows/check.yml | 2 +- Cargo.lock | 143 ++++++++++++++++++------------------ Cargo.toml | 2 +- src/bin/loadtest.rs | 13 ++-- 4 files changed, 79 insertions(+), 81 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 078383eb..284ca89c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -98,7 +98,7 @@ jobs: # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability strategy: matrix: - msrv: ["1.60.0"] + msrv: ["1.70.0"] name: ubuntu / ${{ matrix.msrv }} steps: - uses: actions/checkout@v4 diff --git a/Cargo.lock b/Cargo.lock index 6c44ebb6..889a3256 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,14 +18,51 @@ dependencies = [ ] [[package]] -name = "atty" -version = "0.2.14" +name = "anstream" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ - "hermit-abi", - "libc", - "winapi", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys", ] [[package]] @@ -97,27 +134,36 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.25" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" dependencies = [ - "atty", - "bitflags 1.3.2", + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +dependencies = [ + "anstream", + "anstyle", "clap_lex", - "indexmap", "strsim", - "termcolor", - "textwrap", ] [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "core-foundation" @@ -320,21 +366,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hostname" version = "0.3.1" @@ -385,16 +416,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", -] - [[package]] name = "itoa" version = "1.0.10" @@ -523,12 +544,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -738,21 +753,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "termcolor" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" version = "1.0.56" @@ -826,6 +826,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "vcpkg" version = "0.2.15" @@ -914,15 +920,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 9b42d389..2ac47d54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ chrono = { version = "0.4", features = ["serde", "clock"], default-features = fa url = "2" fnv = "1.0.5" native-tls = { version = "0.2", optional = true } -clap = { version = "3.1.0", optional = true } +clap = { version = "4.4.10", optional = true } thiserror = "1.0.30" derive_builder = "0.12.0" diff --git a/src/bin/loadtest.rs b/src/bin/loadtest.rs index 22ec82e8..e5a24e41 100644 --- a/src/bin/loadtest.rs +++ b/src/bin/loadtest.rs @@ -1,3 +1,4 @@ +use clap::value_parser; use clap::{Arg, Command}; use faktory::*; use rand::prelude::*; @@ -16,21 +17,21 @@ fn main() { .arg( Arg::new("jobs") .help("Number of jobs to run") + .value_parser(value_parser!(usize)) .index(1) - .default_value("30000") - .takes_value(true), + .default_value("30000"), ) .arg( Arg::new("threads") .help("Number of consumers/producers to run") + .value_parser(value_parser!(usize)) .index(2) - .default_value("10") - .takes_value(true), + .default_value("10"), ) .get_matches(); - let jobs = matches.value_of_t_or_exit::("jobs"); - let threads = matches.value_of_t_or_exit::("threads"); + let jobs: usize = *matches.get_one("jobs").expect("default_value is set"); + let threads: usize = *matches.get_one("threads").expect("default_value is set"); println!( "Running loadtest with {} jobs and {} threads", jobs, threads From 8c06cc7d0d84d337f2c29da3fab9708cffea143f Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Wed, 3 Jan 2024 20:21:17 +0100 Subject: [PATCH 2/4] Make retry isize again To avoid the builder stuff being a breaking change --- src/proto/single/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proto/single/mod.rs b/src/proto/single/mod.rs index 349acf67..011544ed 100644 --- a/src/proto/single/mod.rs +++ b/src/proto/single/mod.rs @@ -14,7 +14,7 @@ pub use self::resp::*; const JOB_DEFAULT_QUEUE: &str = "default"; const JOB_DEFAULT_RESERVED_FOR_SECS: usize = 600; -const JOB_DEFAULT_RETRY_COUNT: usize = 25; +const JOB_DEFAULT_RETRY_COUNT: isize = 25; const JOB_DEFAULT_PRIORITY: u8 = 5; const JOB_DEFAULT_BACKTRACE: usize = 0; @@ -108,7 +108,7 @@ pub struct Job { /// Defaults to 25. #[serde(skip_serializing_if = "Option::is_none")] #[builder(default = "Some(JOB_DEFAULT_RETRY_COUNT)")] - pub retry: Option, + pub retry: Option, /// The priority of this job from 1-9 (9 is highest). /// From 111a48b040ab9a242815a5fb6fcf359735980294 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Wed, 3 Jan 2024 20:23:18 +0100 Subject: [PATCH 3/4] Bump to 2021 edition --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2ac47d54..eff272c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "faktory" version = "0.12.1" authors = ["Jon Gjengset "] -edition = "2018" +edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" From 03775db8ce1b9526fa58fc304bf4dea36f8d45ea Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Wed, 3 Jan 2024 20:24:04 +0100 Subject: [PATCH 4/4] Release 0.12.2 with job builder --- Cargo.lock | 2 +- Cargo.toml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 889a3256..2857d402 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,7 +288,7 @@ dependencies = [ [[package]] name = "faktory" -version = "0.12.1" +version = "0.12.2" dependencies = [ "bufstream", "chrono", diff --git a/Cargo.toml b/Cargo.toml index eff272c7..c0eebd9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "faktory" -version = "0.12.1" +version = "0.12.2" authors = ["Jon Gjengset "] edition = "2021" license = "MIT OR Apache-2.0" -readme = "README.md" description = "API bindings for the language-agnostic Faktory work server" repository = "https://github.com/jonhoo/faktory-rs.git"