Skip to content

Commit 5487d2b

Browse files
committed
rename variables a bit
1 parent e0161f5 commit 5487d2b

File tree

1 file changed

+22
-22
lines changed
  • libsql-server/src/http/admin

1 file changed

+22
-22
lines changed

libsql-server/src/http/admin/mod.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -326,39 +326,39 @@ async fn handle_post_config<C>(
326326
.namespaces
327327
.config_store(NamespaceName::from_string(namespace.clone())?)
328328
.await?;
329-
let mut config_after = (*store.get()).clone();
330-
let config_before = config_after.clone();
331-
config_after.block_reads = req.block_reads;
332-
config_after.block_writes = req.block_writes;
333-
config_after.block_reason = req.block_reason;
334-
config_after.allow_attach = req.allow_attach;
335-
config_after.txn_timeout = req.txn_timeout_s.map(Duration::from_secs);
329+
let original = (*store.get()).clone();
330+
let mut updated = original.clone();
331+
updated.block_reads = req.block_reads;
332+
updated.block_writes = req.block_writes;
333+
updated.block_reason = req.block_reason;
334+
updated.allow_attach = req.allow_attach;
335+
updated.txn_timeout = req.txn_timeout_s.map(Duration::from_secs);
336336
if let Some(size) = req.max_db_size {
337-
config_after.max_db_pages = size.as_u64() / LIBSQL_PAGE_SIZE;
337+
updated.max_db_pages = size.as_u64() / LIBSQL_PAGE_SIZE;
338338
}
339339
if let Some(url) = req.heartbeat_url {
340-
config_after.heartbeat_url = Some(Url::parse(&url)?);
340+
updated.heartbeat_url = Some(Url::parse(&url)?);
341341
}
342-
config_after.jwt_key = req.jwt_key;
342+
updated.jwt_key = req.jwt_key;
343343
if let Some(mode) = req.durability_mode {
344-
config_after.durability_mode = mode;
344+
updated.durability_mode = mode;
345345
}
346346

347-
store.store(config_after.clone()).await?;
347+
store.store(updated.clone()).await?;
348348
// we better to not log jwt token - so let's explicitly log necessary fields
349349
tracing::info!(
350350
message = "updated db config",
351351
namespace = namespace,
352-
block_writes_before = config_before.block_writes,
353-
block_writes_after = config_after.block_writes,
354-
block_reads_before = config_before.block_reads,
355-
block_reads_after = config_after.block_reads,
356-
allow_attach_before = config_before.allow_attach,
357-
allow_attach_after = config_after.allow_attach,
358-
max_db_pages_before = config_before.max_db_pages,
359-
max_db_pages_after = config_after.max_db_pages,
360-
durability_mode_before = config_before.durability_mode.to_string(),
361-
durability_mode_after = config_after.durability_mode.to_string(),
352+
block_writes_before = original.block_writes,
353+
block_writes_after = updated.block_writes,
354+
block_reads_before = original.block_reads,
355+
block_reads_after = updated.block_reads,
356+
allow_attach_before = original.allow_attach,
357+
allow_attach_after = updated.allow_attach,
358+
max_db_pages_before = original.max_db_pages,
359+
max_db_pages_after = updated.max_db_pages,
360+
durability_mode_before = original.durability_mode.to_string(),
361+
durability_mode_after = updated.durability_mode.to_string(),
362362
);
363363

364364
Ok(())

0 commit comments

Comments
 (0)