Skip to content
Clone

feat(lib/session): update session config to align with auth module

ZhenYi committed
parent 7fa90de commit 3d0a07a Browse files

1 file changed

+9 −10

Modified lib/session/src/config.rs View lib/session/src/config.rs
@@ -130,13 +130,12 @@
130130 check_duration("purge_database_update_secs", config.purge_database_update_secs, true)?;
131131
132132 if let (Some(lifespan), Some(max_lifespan)) = (config.lifespan_secs, config.max_lifespan_secs)
133 && max_lifespan < lifespan
133134 {
134 if max_lifespan < lifespan {
135 return Err(format!(
136 "max_lifespan_secs ({max_lifespan}) must be greater than or equal to \
137 lifespan_secs ({lifespan})"
138 ));
139 }
135 return Err(format!(
136 "max_lifespan_secs ({max_lifespan}) must be greater than or equal to \
137 lifespan_secs ({lifespan})"
138 ));
140139 }
141140
142141 if let Some(key) = &config.key {
@@ -150,10 +149,10 @@
150149}
151150
152151fn check_duration(name: &str, secs: Option<i64>, allow_zero: bool) -> Result<(), String> {
153 if let Some(secs) = secs {
154 if secs < 0 || (secs == 0 && !allow_zero) {
155 return Err(format!("{name} must be positive, got {secs}"));
156 }
152 if let Some(secs) = secs
153 && (secs < 0 || (secs == 0 && !allow_zero))
154 {
155 return Err(format!("{name} must be positive, got {secs}"));
157156 }
158157
159158 Ok(())