@@ -21,7 +21,7 @@ public partial class GeneratedRelationalAIClient
2121
2222 public const string JSON_CONTENT_TYPE = "application/json" ;
2323 public const string CSV_CONTENT_TYPE = "text/csv" ;
24- public const string USER_AGENT_HEADER = "KGMSClient/1.2.5 /csharp" ;
24+ public const string USER_AGENT_HEADER = "KGMSClient/1.2.1 /csharp" ;
2525
2626 public int DebugLevel = Connection . DEFAULT_DEBUG_LEVEL ;
2727
@@ -78,25 +78,6 @@ partial void PrepareRequest(Transaction body, HttpClient client, HttpRequestMess
7878
7979 // use HTTP 2.0 (to handle keep-alive)
8080 request . Version = System . Net . HttpVersion . Version20 ;
81-
82- // have a separate keep-alive task (per thread)
83- if ( ! isStatusRequest ( body ) ) {
84- var tokenSource = new CancellationTokenSource ( ) ;
85- AsyncLocalKeepAliveCancellationTokenSource . Value = tokenSource ;
86- CancellationToken ct = tokenSource . Token ;
87-
88- /**
89- * TODO: currently we swallo exceptions in KeepClientAlive.
90- * If we want to throw, then we need to change this to asynchronously handle the throw
91- * e.g.
92- * try {
93- await this.KeepClientAlive(client, url, ct).ConfigureAwait(false);
94- } catch (Exception e) {
95- // Handle here
96- }
97- **/
98- var keep_alive_task = this . KeepClientAlive ( client , url , ct ) . ConfigureAwait ( false ) ;
99- }
10081 }
10182
10283 private bool isStatusRequest ( Transaction txn )
@@ -127,11 +108,6 @@ private bool _isEmpty(string str)
127108 {
128109 return str == null || str . Length == 0 ;
129110 }
130-
131- public virtual Task KeepClientAlive ( HttpClient client_ , String url , CancellationToken ct )
132- {
133- throw new NotImplementedException ( ) ;
134- }
135111 }
136112
137113 public partial class Transaction
@@ -356,46 +332,6 @@ public ILogger Logger
356332 }
357333 private ILogger _logger ;
358334
359- public override async Task KeepClientAlive ( HttpClient client_ , String url , CancellationToken ct )
360- {
361- while ( true )
362- {
363- ct . ThrowIfCancellationRequested ( ) ;
364- await Task . Delay ( HttpClientFactory . KEEP_ALIVE_INTERVAL * 1000 ) ;
365- ct . ThrowIfCancellationRequested ( ) ;
366-
367- try {
368- await Task . Run ( ( ) => this . KeepAliveProbe ( client_ , ct ) ) ;
369- } catch ( Exception e ) {
370- // ignore. But I think we might want to throw?
371- Logger . Error ( "KeepAliveProbe failed with exception: " + e . Message ) ;
372- }
373- }
374- }
375-
376- private async void KeepAliveProbe ( HttpClient client_ , CancellationToken ct )
377- {
378- // Send "HEAD / HTTP/2" request.
379- var request = new System . Net . Http . HttpRequestMessage ( ) ;
380- request . Method = new System . Net . Http . HttpMethod ( "HEAD" ) ;
381- request . RequestUri = new System . Uri ( this . BaseUrl , System . UriKind . RelativeOrAbsolute ) ;
382- request . Version = System . Net . HttpVersion . Version20 ;
383-
384- var keepaliveFailureCnt = 0 ;
385- try {
386- await client_ . SendAsync ( request , System . Net . Http . HttpCompletionOption . ResponseHeadersRead , ct ) . ConfigureAwait ( false ) ;
387- } catch ( Exception e ) {
388- keepaliveFailureCnt ++ ;
389- // KEEP_ALIVE_RETRIES may be too big here (16) for the interval of 3 minutes
390- if ( keepaliveFailureCnt < HttpClientFactory . KEEP_ALIVE_RETRIES ) {
391- Logger . Warning ( "KeepAliveProbe failed to send request: " + e . Message ) ;
392- } else {
393- Logger . Error ( "KeepAliveProbe failed to send request: " + e . Message ) ;
394- Logger . Error ( "KeepAliveProbe retry exceeded max. Throwing" ) ;
395- throw e ;
396- }
397- }
398- }
399335
400336 public static void AddExtraHeaders ( HttpRequestMessage request )
401337 {
@@ -959,13 +895,6 @@ public bool EnableLibrary(string srcName)
959895 return RunAction ( action ) != null ;
960896 }
961897
962- public bool CloseDatabase ( )
963- {
964- var action = new ModifyWorkspaceAction ( ) ;
965- action . Close_database = conn . DbName ;
966- return RunAction ( action , isReadOnly : true ) != null ;
967- }
968-
969898 public ICollection < Relation > Cardinality ( string relName = null )
970899 {
971900 var action = new CardinalityAction ( ) ;
0 commit comments