Skip to content

Commit a082874

Browse files
committed
do not update external XML log if no changes
1 parent 109326b commit a082874

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/serve_2.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,21 @@ serve_update_external_xml_log(serve_state_t state,
292292
{
293293
if (!state->global->external_xml_update_time) return;
294294
if (state->current_time < state->last_update_external_xml_log + state->global->external_xml_update_time) return;
295+
296+
long long runlog_last_update_time_us = run_get_last_update_time_us(state->runlog_state);
297+
if (!state->last_update_external_xml_log_us && !runlog_last_update_time_us) {
298+
// not updated yet
299+
300+
struct timeval tv;
301+
gettimeofday(&tv, NULL);
302+
long long current_time_us = tv.tv_sec * 1000000LL + tv.tv_usec;
303+
state->last_update_external_xml_log_us = current_time_us;
304+
} else if (state->last_update_external_xml_log_us >= runlog_last_update_time_us) {
305+
return;
306+
} else {
307+
state->last_update_external_xml_log_us = runlog_last_update_time_us;
308+
}
309+
295310
state->last_update_external_xml_log = state->current_time;
296311
do_update_xml_log(state, cnts, "external.xml", 1);
297312
}

0 commit comments

Comments
 (0)