You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2022/08/16 18:55:41 UTC

[trafficserver] branch master updated: utilize proxy.config.hostdb.host_file.interval config variable (#9039)

This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 60a91e6b9 utilize proxy.config.hostdb.host_file.interval config variable (#9039)
60a91e6b9 is described below

commit 60a91e6b96e914ad3fb5c43c5917cdf0ee8e21d1
Author: Chris McFarlen <ch...@mcfarlen.us>
AuthorDate: Tue Aug 16 13:55:36 2022 -0500

    utilize proxy.config.hostdb.host_file.interval config variable (#9039)
---
 iocore/hostdb/HostDB.cc           | 11 +++++++++++
 iocore/hostdb/P_HostDBProcessor.h |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 0095fd70f..7481d85a5 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 3ebd270a8..a373a08a5 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();