File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ clicolors-control = "1.0"
4242crc32c = { version = " 0.6.6" , optional = true }
4343derive_more = " 0.99"
4444fail = { version = " 0.5.1" }
45+ fastrand = " 2.3.0"
4546filetime = " 0.2"
4647futures = { version = " 0.3" , optional = true }
4748globset = " 0.4.5"
@@ -107,7 +108,6 @@ predicates = "3"
107108pretty_assertions = " 1.0"
108109proptest = " 1.5"
109110proptest-derive = " 0.5"
110- rand = " 0.8"
111111rstest = { version = " 0.19" , default-features = false }
112112tracing-test = { version = " 0.2" , features = [" no-env-filter" ] }
113113
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ impl Lease {
9999 client_version : Some ( crate :: VERSION . to_string ( ) ) ,
100100 acquired : lease_taken,
101101 expiry : lease_expiry,
102+ nonce : fastrand:: u32 ( ..) ,
102103 } ;
103104 let url = transport. url ( ) . join ( LEASE_FILENAME ) . unwrap ( ) ;
104105 let mut s: String = serde_json:: to_string ( & content) . expect ( "serialize lease" ) ;
@@ -221,6 +222,8 @@ pub struct LeaseContent {
221222 pub pid : Option < u32 > ,
222223 /// Conserve version string.
223224 pub client_version : Option < String > ,
225+ /// Random nonce to distinguish different leases from the same client.
226+ pub nonce : u32 ,
224227
225228 /// Time when the lease was taken.
226229 #[ serde( with = "time::serde::iso8601" ) ]
@@ -330,7 +333,8 @@ mod test {
330333 "pid": 1234,
331334 "client_version": "0.1.2",
332335 "acquired": "2021-01-01T12:34:56Z",
333- "expiry": "2021-01-01T12:35:56Z"
336+ "expiry": "2021-01-01T12:35:56Z",
337+ "nonce": 12345
334338 }"# ,
335339 )
336340 . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments