Skip to content

Commit

Permalink
log tx-registry-spider
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Jan 16, 2024
1 parent a98eb5b commit dc5f339
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion server/endpoint_txregistry.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion server/tx_registry_spider.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dc5f339

Please sign in to comment.