Skip to content
Merged
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
18 changes: 17 additions & 1 deletion ydb/library/actors/http/http_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class THttpProxy : public NActors::TActorBootstrapped<THttpProxy>, public THttpC
void Handle(TEvHttpProxy::TEvResolveHostRequest::TPtr event, const NActors::TActorContext& ctx) {
const TString& host(event->Get()->Host);
auto it = Hosts.find(host);
if (it == Hosts.end() || it->second.DeadlineTime > ctx.Now()) {
if (it == Hosts.end() || it->second.DeadlineTime < ctx.Now()) {
TString addressPart;
TIpPort portPart = 0;
CrackAddress(host, addressPart, portPart);
Expand Down Expand Up @@ -174,6 +174,22 @@ class THttpProxy : public NActors::TActorBootstrapped<THttpProxy>, public THttpC
it->second.DeadlineTime = ctx.Now() + HostsTimeToLive;
}
}
catch (const TNetworkResolutionError& e) {
if (it != Hosts.end()) {
ctx.Send(event->Sender, new TEvHttpProxy::TEvResolveHostResponse(it->first, it->second.Address));
return;
} else {
ctx.Send(event->Sender,
new TEvHttpProxy::TEvResolveHostResponse(
TStringBuilder()
<< "Resolution failed and no stale cached value has been found to fallback.\n"
<< "Resolution error: "
<< e.what()
)
);
return;
}
}
catch (const yexception& e) {
ctx.Send(event->Sender, new TEvHttpProxy::TEvResolveHostResponse(e.what()));
return;
Expand Down