Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions iocore/hostdb/HostDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions iocore/hostdb/P_HostDBProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down