@@ -18,14 +18,7 @@ import type {TNetInfo} from '../types/api/netInfo';
18
18
import type { TNodesInfo } from '../types/api/nodes' ;
19
19
import type { TEvNodesInfo } from '../types/api/nodesList' ;
20
20
import 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' ;
29
22
import type { JsonRenderRequestParams , JsonRenderResponse } from '../types/api/render' ;
30
23
import type { RestartPDiskResponse } from '../types/api/restartPDisk' ;
31
24
import type { TEvDescribeSchemeResult } from '../types/api/schema' ;
@@ -53,14 +46,17 @@ import {settingsManager} from './settings';
53
46
type AxiosOptions = {
54
47
concurrentId ?: string ;
55
48
signal ?: AbortSignal ;
49
+ withRetries ?: boolean ;
56
50
} ;
57
51
58
52
export class YdbEmbeddedAPI extends AxiosWrapper {
53
+ DEFAULT_RETRIES_COUNT = 3 ;
54
+
59
55
constructor ( options ?: AxiosWrapperOptions ) {
60
56
super ( options ) ;
61
57
62
58
axiosRetry ( this . _axios , {
63
- retries : 3 ,
59
+ retries : this . DEFAULT_RETRIES_COUNT ,
64
60
retryDelay : axiosRetry . exponentialDelay ,
65
61
} ) ;
66
62
@@ -442,7 +438,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
442
438
schema ?: Schema ;
443
439
syntax ?: QuerySyntax ;
444
440
} ,
445
- { concurrentId, signal} : AxiosOptions = { } ,
441
+ { concurrentId, signal, withRetries } : AxiosOptions = { } ,
446
442
) {
447
443
// Time difference to ensure that timeout from ui will be shown rather than backend error
448
444
const uiTimeout = 9 * 60 * 1000 ;
@@ -468,38 +464,11 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
468
464
{
469
465
concurrentId,
470
466
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
+ } ,
501
471
} ,
502
- { } ,
503
472
) ;
504
473
}
505
474
getHotKeys (
@@ -562,6 +531,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
562
531
// Automatic headers may not suit
563
532
Accept : 'application/json' ,
564
533
} ,
534
+ requestConfig : { 'axios-retry' : { retries : 0 } } ,
565
535
} ,
566
536
) ;
567
537
}
@@ -580,22 +550,29 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
580
550
headers : {
581
551
'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8' ,
582
552
} ,
553
+ requestConfig : { 'axios-retry' : { retries : 0 } } ,
583
554
} ,
584
555
) ;
585
556
}
586
557
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
+ ) ;
588
563
}
589
564
stopTablet ( id ?: string , hiveId ?: string ) {
590
565
return this . get < string > (
591
566
this . getPath ( `/tablets/app?TabletID=${ hiveId } &page=StopTablet&tablet=${ id } ` ) ,
592
567
{ } ,
568
+ { requestConfig : { 'axios-retry' : { retries : 0 } } } ,
593
569
) ;
594
570
}
595
571
resumeTablet ( id ?: string , hiveId ?: string ) {
596
572
return this . get < string > (
597
573
this . getPath ( `/tablets/app?TabletID=${ hiveId } &page=ResumeTablet&tablet=${ id } ` ) ,
598
574
{ } ,
575
+ { requestConfig : { 'axios-retry' : { retries : 0 } } } ,
599
576
) ;
600
577
}
601
578
getTabletDescribe ( tenantId : TDomainKey , { concurrentId, signal} : AxiosOptions = { } ) {
0 commit comments