diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 0095fd70f80..7481d85a5e6 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -562,6 +562,7 @@ HostDBProcessor::start(int, size_t) HostDBContinuation *b = hostDBContAllocator.alloc(); SET_CONTINUATION_HANDLER(b, (HostDBContHandler)&HostDBContinuation::backgroundEvent); b->mutex = new_ProxyMutex(); + b->updateHostFileConfig(); eventProcessor.schedule_every(b, HRTIME_SECONDS(1), ET_DNS); return 0; @@ -1512,6 +1513,15 @@ HostDBContinuation::do_dns() } } +void +HostDBContinuation::updateHostFileConfig() +{ + RecInt tmp_interval{}; + + REC_ReadConfigInteger(tmp_interval, "proxy.config.hostdb.host_file.interval"); + hostdb_hostfile_check_interval = std::chrono::seconds(tmp_interval); +} + // // Background event // Increment the hostdb_current_timestamp which funcions as our cached version @@ -1533,6 +1543,7 @@ HostDBContinuation::backgroundEvent(int /* event ATS_UNUSED */, Event * /* e ATS bool update_p = false; // do we need to reparse the file and update? char path[PATH_NAME_MAX]; + updateHostFileConfig(); REC_ReadConfigString(path, "proxy.config.hostdb.host_file.path", sizeof(path)); if (0 != strcasecmp(hostdb_hostfile_path.string(), path)) { Debug("hostdb", "%s", diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h index 3ebd270a827..a373a08a59f 100644 --- a/iocore/hostdb/P_HostDBProcessor.h +++ b/iocore/hostdb/P_HostDBProcessor.h @@ -257,6 +257,9 @@ struct HostDBContinuation : public Continuation { int retryEvent(int event, Event *e); int setbyEvent(int event, Event *e); + // update the host file config variables + void updateHostFileConfig(); + /// Recompute the hash and update ancillary values. void refresh_hash(); void do_dns();