Commit 3a4d95f0 authored by Libor Peltan's avatar Libor Peltan

zone: moved immediate zone flush to zone_update_commit

parent 3c0e0960
......@@ -444,12 +444,6 @@ static int zone_txn_commit(zone_t *zone, ctl_args_t *args)
free(zone->control_update);
zone->control_update = NULL;
/* Sync zonefile immediately if configured. */
val = conf_zone_get(conf(), C_ZONEFILE_SYNC, zone->name);
if (conf_int(&val) == 0) {
zone_events_schedule_now(zone, ZONE_EVENT_FLUSH);
}
zone_events_schedule_now(zone, ZONE_EVENT_NOTIFY);
return KNOT_EOK;
......
......@@ -40,8 +40,6 @@ void event_dnssec_reschedule(conf_t *conf, zone_t *zone,
return;
}
conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
log_dnssec_next(zone->name, (time_t)refresh_at);
if (refresh->plan_ds_query) {
......@@ -57,8 +55,7 @@ void event_dnssec_reschedule(conf_t *conf, zone_t *zone,
ZONE_EVENT_DNSSEC, (time_t)refresh_at,
ZONE_EVENT_PARENT_DS_Q, refresh->plan_ds_query ? now : ignore,
ZONE_EVENT_NSEC3RESALT, refresh->next_nsec3resalt ? refresh->next_nsec3resalt : ignore,
ZONE_EVENT_NOTIFY, zone_changed ? now : ignore,
ZONE_EVENT_FLUSH, zone_changed && conf_int(&val) == 0 ? now : ignore
ZONE_EVENT_NOTIFY, zone_changed ? now : ignore
);
}
......
......@@ -164,8 +164,6 @@ int event_load(conf_t *conf, zone_t *zone)
goto cleanup;
}
int zf_serial = (zf_conts == NULL ? -1 : (int)zone_contents_serial(zf_conts));
// The contents are already part of zone_update.
zf_conts = NULL;
journal_conts = NULL;
......@@ -214,13 +212,6 @@ int event_load(conf_t *conf, zone_t *zone)
zone_events_schedule_now(zone, ZONE_EVENT_NOTIFY);
}
if (zf_serial > -1 && (uint32_t)zf_serial != new_serial) {
val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
if (conf_int(&val) == 0) {
zone_events_schedule_now(zone, ZONE_EVENT_FLUSH);
}
}
return KNOT_EOK;
cleanup:
......
......@@ -1132,12 +1132,6 @@ int event_refresh(conf_t *conf, zone_t *zone)
replan_from_timers(conf, zone);
if (updated) {
zone_events_schedule_at(zone, ZONE_EVENT_NOTIFY, time(NULL) + 1);
conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
int64_t sync_timeout = conf_int(&val);
if (sync_timeout == 0) {
zone_events_schedule_now(zone, ZONE_EVENT_FLUSH);
}
}
if (!bootstrap) {
......
......@@ -183,12 +183,6 @@ static int process_normal(conf_t *conf, zone_t *zone, list_t *requests)
return ret;
}
/* Sync zonefile immediately if configured. */
val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name);
if (conf_int(&val) == 0) {
zone_events_schedule_now(zone, ZONE_EVENT_FLUSH);
}
return KNOT_EOK;
}
......
......@@ -698,6 +698,12 @@ int zone_update_commit(conf_t *conf, zone_update_t *update)
update->a_ctx = NULL;
update->new_cont = NULL;
/* Sync zonefile immediately if configured. */
val = conf_zone_get(conf, C_ZONEFILE_SYNC, update->zone->name);
if (conf_int(&val) == 0) {
zone_events_schedule_now(update->zone, ZONE_EVENT_FLUSH);
}
return KNOT_EOK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment