@@ -763,13 +763,15 @@ void TViewerPipeClient::HandleResolveResource(TEvTxProxySchemeCache::TEvNavigate
763
763
SharedDatabase = CanonizePath (entry.Path );
764
764
if (SharedDatabase == AppData ()->TenantName ) {
765
765
Direct = true ;
766
- return Bootstrap (); // retry bootstrap without redirect this time
766
+ Bootstrap (); // retry bootstrap without redirect this time
767
+ } else {
768
+ DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (SharedDatabase);
767
769
}
768
- DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (SharedDatabase);
769
770
} else {
770
- ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - shared database not found" ));
771
+ return ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - shared database not found" ));
771
772
}
772
773
}
774
+ RequestDone ();
773
775
}
774
776
775
777
void TViewerPipeClient::HandleResolveDatabase (TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev) {
@@ -780,24 +782,27 @@ void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigate
780
782
if (entry.DomainInfo && entry.DomainInfo ->ResourcesDomainKey && entry.DomainInfo ->DomainKey != entry.DomainInfo ->ResourcesDomainKey ) {
781
783
ResourceNavigateResponse = MakeRequestSchemeCacheNavigate (TPathId (entry.DomainInfo ->ResourcesDomainKey ));
782
784
Become (&TViewerPipeClient::StateResolveResource);
783
- return ;
785
+ } else {
786
+ DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (CanonizePath (entry.Path ));
784
787
}
785
- DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup (CanonizePath (entry.Path ));
786
788
} else {
787
- ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - not found" ));
789
+ return ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - not found" ));
788
790
}
789
791
}
792
+ RequestDone ();
790
793
}
791
794
792
795
void TViewerPipeClient::HandleResolve (TEvStateStorage::TEvBoardInfo::TPtr& ev) {
793
796
if (DatabaseBoardInfoResponse) {
794
797
DatabaseBoardInfoResponse->Set (std::move (ev));
795
798
if (DatabaseBoardInfoResponse->IsOk ()) {
796
- ReplyAndPassAway (MakeForward (GetNodesFromBoardReply (DatabaseBoardInfoResponse->GetRef ())));
799
+ return ReplyAndPassAway (MakeForward (GetNodesFromBoardReply (DatabaseBoardInfoResponse->GetRef ())));
797
800
} else {
798
- ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " Failed to resolve database - no nodes found" ));
801
+ Direct = true ;
802
+ Bootstrap (); // retry bootstrap without redirect this time
799
803
}
800
804
}
805
+ RequestDone ();
801
806
}
802
807
803
808
void TViewerPipeClient::HandleTimeout () {
@@ -825,6 +830,7 @@ void TViewerPipeClient::RedirectToDatabase(const TString& database) {
825
830
Become (&TViewerPipeClient::StateResolveDatabase);
826
831
}
827
832
833
+ // Call only from Bootstrap() method
828
834
bool TViewerPipeClient::NeedToRedirect () {
829
835
if (Event) {
830
836
Direct |= !Event->Get ()->Request .GetHeader (" X-Forwarded-From-Node" ).empty (); // we're already forwarding
0 commit comments