@@ -18,14 +18,7 @@ import type {TNetInfo} from '../types/api/netInfo';
1818import type { TNodesInfo } from '../types/api/nodes' ;
1919import type { TEvNodesInfo } from '../types/api/nodesList' ;
2020import type { TEvPDiskStateResponse , TPDiskInfoResponse } from '../types/api/pdisk' ;
21- import type {
22- Actions ,
23- ErrorResponse ,
24- ExplainActions ,
25- ExplainResponse ,
26- QueryAPIResponse ,
27- Schemas ,
28- } from '../types/api/query' ;
21+ import type { Actions , ErrorResponse , QueryAPIResponse , Schemas } from '../types/api/query' ;
2922import type { JsonRenderRequestParams , JsonRenderResponse } from '../types/api/render' ;
3023import type { RestartPDiskResponse } from '../types/api/restartPDisk' ;
3124import type { TEvDescribeSchemeResult } from '../types/api/schema' ;
@@ -53,14 +46,17 @@ import {settingsManager} from './settings';
5346type AxiosOptions = {
5447 concurrentId ?: string ;
5548 signal ?: AbortSignal ;
49+ withRetries ?: boolean ;
5650} ;
5751
5852export class YdbEmbeddedAPI extends AxiosWrapper {
53+ DEFAULT_RETRIES_COUNT = 3 ;
54+
5955 constructor ( options ?: AxiosWrapperOptions ) {
6056 super ( options ) ;
6157
6258 axiosRetry ( this . _axios , {
63- retries : 3 ,
59+ retries : this . DEFAULT_RETRIES_COUNT ,
6460 retryDelay : axiosRetry . exponentialDelay ,
6561 } ) ;
6662
@@ -442,7 +438,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
442438 schema ?: Schema ;
443439 syntax ?: QuerySyntax ;
444440 } ,
445- { concurrentId, signal} : AxiosOptions = { } ,
441+ { concurrentId, signal, withRetries } : AxiosOptions = { } ,
446442 ) {
447443 // Time difference to ensure that timeout from ui will be shown rather than backend error
448444 const uiTimeout = 9 * 60 * 1000 ;
@@ -468,38 +464,11 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
468464 {
469465 concurrentId,
470466 timeout : uiTimeout ,
471- requestConfig : { signal} ,
472- } ,
473- ) ;
474- }
475- getExplainQuery < Action extends ExplainActions > (
476- query : string ,
477- database : string ,
478- action : Action ,
479- syntax ?: QuerySyntax ,
480- ) {
481- return this . post < ExplainResponse < Action > | ErrorResponse > (
482- this . getPath ( '/viewer/json/query' ) ,
483- {
484- query,
485- database,
486- action : action || 'explain' ,
487- syntax,
488- timeout : 600000 ,
489- } ,
490- { } ,
491- ) ;
492- }
493- getExplainQueryAst ( query : string , database : string ) {
494- return this . post < ExplainResponse < 'explain-ast' > > (
495- this . getPath ( '/viewer/json/query' ) ,
496- {
497- query,
498- database,
499- action : 'explain-ast' ,
500- timeout : 600000 ,
467+ requestConfig : {
468+ signal,
469+ 'axios-retry' : { retries : withRetries ? this . DEFAULT_RETRIES_COUNT : 0 } ,
470+ } ,
501471 } ,
502- { } ,
503472 ) ;
504473 }
505474 getHotKeys (
@@ -562,6 +531,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
562531 // Automatic headers may not suit
563532 Accept : 'application/json' ,
564533 } ,
534+ requestConfig : { 'axios-retry' : { retries : 0 } } ,
565535 } ,
566536 ) ;
567537 }
@@ -580,22 +550,29 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
580550 headers : {
581551 'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8' ,
582552 } ,
553+ requestConfig : { 'axios-retry' : { retries : 0 } } ,
583554 } ,
584555 ) ;
585556 }
586557 killTablet ( id ?: string ) {
587- return this . get < string > ( this . getPath ( `/tablets?KillTabletID=${ id } ` ) , { } ) ;
558+ return this . get < string > (
559+ this . getPath ( `/tablets?KillTabletID=${ id } ` ) ,
560+ { } ,
561+ { requestConfig : { 'axios-retry' : { retries : 0 } } } ,
562+ ) ;
588563 }
589564 stopTablet ( id ?: string , hiveId ?: string ) {
590565 return this . get < string > (
591566 this . getPath ( `/tablets/app?TabletID=${ hiveId } &page=StopTablet&tablet=${ id } ` ) ,
592567 { } ,
568+ { requestConfig : { 'axios-retry' : { retries : 0 } } } ,
593569 ) ;
594570 }
595571 resumeTablet ( id ?: string , hiveId ?: string ) {
596572 return this . get < string > (
597573 this . getPath ( `/tablets/app?TabletID=${ hiveId } &page=ResumeTablet&tablet=${ id } ` ) ,
598574 { } ,
575+ { requestConfig : { 'axios-retry' : { retries : 0 } } } ,
599576 ) ;
600577 }
601578 getTabletDescribe ( tenantId : TDomainKey , { concurrentId, signal} : AxiosOptions = { } ) {
0 commit comments