From dc5f339e93fa302c43791293348388456df14de4 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 16 Jan 2024 15:55:53 +1100 Subject: [PATCH] log tx-registry-spider --- server/endpoint_txregistry.pas | 5 ++++- server/tx_registry_spider.pas | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/server/endpoint_txregistry.pas b/server/endpoint_txregistry.pas index 64d22d1b6..604e3ca0a 100644 --- a/server/endpoint_txregistry.pas +++ b/server/endpoint_txregistry.pas @@ -43,6 +43,9 @@ interface tx_manager, time_tracker, kernel_thread, server_stats, web_event, web_base, endpoint, session; +const + SCAN_FREQUENCY = ((1/24) / 4); // 15 min + type TTxRegistryServerEndPoint = class; @@ -281,7 +284,7 @@ procedure TTxRegistryUpdaterThread.Execute; finally FEndPoint.FTxRegistryServer.scanning := false; end; - FEndPoint.FTxRegistryServer.NextScan := ((1/24) / 4); // every ten minutes + FEndPoint.FTxRegistryServer.NextScan := SCAN_FREQUENCY; // every 15 minutes end; procedure TTxRegistryUpdaterThread.Initialise; diff --git a/server/tx_registry_spider.pas b/server/tx_registry_spider.pas index e21cd0d13..04b8e19c1 100644 --- a/server/tx_registry_spider.pas +++ b/server/tx_registry_spider.pas @@ -37,7 +37,7 @@ interface IdHashSHA, fsl_base, fsl_utilities, fsl_json, fsl_logging, fsl_versions, fsl_http, fsl_threads, fsl_fetcher, fsl_zulip, - fhir_objects, fhir_client_http, + fhir_objects, fhir_client, fhir_client_http, fhir3_client, fhir3_types, fhir3_resources_base, fhir3_resources, fhir3_resources_canonical, fhir3_utilities, fhir4_client, fhir4_types, fhir4_resources_base, fhir4_resources, fhir4_resources_canonical, fhir4_utilities, fhir5_client, fhir5_types, fhir5_resources_base, fhir5_resources, fhir5_resources_canonical, fhir5_enums, fhir5_utilities, @@ -80,6 +80,8 @@ TTxRegistryScanner = class (TFslObject) FOnSendEmail : TSendEmailEvent; FIni : TIniFile; FZulip : TZulipTracker; + FLogFileName : String; + procedure DoSendEmail(dest, subj, body : String); procedure log(msg, source : String; error : boolean); @@ -118,6 +120,7 @@ constructor TTxRegistryScanner.Create(zulip: TZulipTracker); inherited Create; FZulip := zulip; FAddress := MASTER_URL; + FLogFileName := FilePath(['[tmp]', 'tx-registry-spider.log']); end; destructor TTxRegistryScanner.Destroy; @@ -180,6 +183,8 @@ procedure TTxRegistryScanner.update(name : String; info : TServerRegistries); reg : TServerRegistry; s : String; begin + DeleteFile(logFileName); + FIni := TIniFile.Create(tempFile('tx-registry-'+name+'.ini')); try info.LastRun := TFslDateTime.makeUTC; @@ -374,6 +379,7 @@ procedure TTxRegistryScanner.processServerVersionR4(version, source, url : Strin try client := TFhirClient4.Create(nil, nil, TFHIRHTTPCommunicator.Create(url)); try + client.Logger := TTextFileLogger.create(logFileName); client.format := ffJson; cs := client.conformance(true); try @@ -448,6 +454,7 @@ procedure TTxRegistryScanner.processServerVersionR5(version, source, url : Strin begin client := TFhirClient5.Create(nil, nil, TFHIRHTTPCommunicator.Create(url)); try + client.Logger := TTextFileLogger.create(FilePath(['[tmp]', 'tx-registry-spider.log'])); client.format := ffJson; cs := client.conformance(true); try @@ -519,6 +526,7 @@ procedure TTxRegistryScanner.processServerVersionR3(version, source, url : Strin begin client := TFhirClient3.Create(nil, nil, TFHIRHTTPCommunicator.Create(url)); try + client.Logger := TTextFileLogger.create(FilePath(['[tmp]', 'tx-registry-spider.log'])); client.format := ffJson; cs := client.conformance(true); try