@@ -482,24 +482,24 @@ let spawn_db_flush_threads () =
482482 try
483483 Thread. delay Db_backend. db_FLUSH_TIMER ;
484484 (* If I have some writing capacity left in this write period then consider doing a write; or
485- if the connection is not write-limited then consider doing a write too.
486- We also have to consider doing a write if exit_on_next_flush is set: because when this is
487- set (by a signal handler) we want to do a flush whether or not our write limit has been
488- exceeded.
485+ if the connection is not write-limited then consider doing a write too.
486+ We also have to consider doing a write if exit_on_next_flush is set: because when this is
487+ set (by a signal handler) we want to do a flush whether or not our write limit has been
488+ exceeded.
489489 *)
490+ (* always flush straight away; this request is urgent
491+ otherwise, we only write if
492+ (i) "coalesscing period has come to an end"; and
493+ (ii) "write limiting requirements are met": *)
490494 ( if
491495 ! Db_connections. exit_on_next_flush
492- (* always flush straight away; this request is urgent *)
493- || (* otherwise, we only write if (i) "coalesscing period has come to an end"; and (ii) "write limiting requirements are met": *)
494- (not (in_coallescing_period () ))
495- (* see (i) above *)
496- && (! my_writes_this_period
497- < dbconn.Parse_db_conf. write_limit_write_cycles
498- || dbconn.Parse_db_conf. mode
499- = Parse_db_conf. No_limit
500- (* (ii) above *)
501- )
502- then (* debug "[%s] considering flush" db_path; *)
496+ || (not (in_coallescing_period () ))
497+ && (! my_writes_this_period
498+ < dbconn.Parse_db_conf. write_limit_write_cycles
499+ || dbconn.Parse_db_conf. mode
500+ = Parse_db_conf. No_limit
501+ )
502+ then
503503 let was_anything_flushed =
504504 Xapi_stdext_threads.Threadext.Mutex. execute
505505 Db_lock. global_flush_mutex (fun () ->
@@ -509,7 +509,7 @@ let spawn_db_flush_threads () =
509509 if was_anything_flushed then (
510510 my_writes_this_period := ! my_writes_this_period + 1 ;
511511 (* when we do a write, reset the coallesce_period_start to now -- recall that this
512- variable tracks the time since last write *)
512+ variable tracks the time since last write *)
513513 coallesce_period_start := Unix. gettimeofday ()
514514 )
515515 ) ;
0 commit comments