@@ -326,39 +326,39 @@ async fn handle_post_config<C>(
326
326
. namespaces
327
327
. config_store ( NamespaceName :: from_string ( namespace. clone ( ) ) ?)
328
328
. 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) ;
336
336
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 ;
338
338
}
339
339
if let Some ( url) = req. heartbeat_url {
340
- config_after . heartbeat_url = Some ( Url :: parse ( & url) ?) ;
340
+ updated . heartbeat_url = Some ( Url :: parse ( & url) ?) ;
341
341
}
342
- config_after . jwt_key = req. jwt_key ;
342
+ updated . jwt_key = req. jwt_key ;
343
343
if let Some ( mode) = req. durability_mode {
344
- config_after . durability_mode = mode;
344
+ updated . durability_mode = mode;
345
345
}
346
346
347
- store. store ( config_after . clone ( ) ) . await ?;
347
+ store. store ( updated . clone ( ) ) . await ?;
348
348
// we better to not log jwt token - so let's explicitly log necessary fields
349
349
tracing:: info!(
350
350
message = "updated db config" ,
351
351
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( ) ,
362
362
) ;
363
363
364
364
Ok ( ( ) )
0 commit comments