@@ -14,15 +14,16 @@ const MASTER_URL = 'https://fhir.github.io/ig-registry/tx-servers.json';
1414class RegistryCrawler {
1515 log ;
1616
17- constructor ( config = { } ) {
17+ constructor ( config = { } , stats ) {
1818 this . config = {
1919 timeout : config . timeout || 30000 , // 30 seconds default
2020 masterUrl : config . masterUrl || MASTER_URL ,
2121 userAgent : config . userAgent || 'HealthIntersections/FhirServer' ,
2222 crawlInterval : config . crawlInterval || 5 * 60 * 1000 , // 5 minutes default
2323 apiKeys : config . apiKeys || { } // Map of server URL or code to API key
2424 } ;
25-
25+ this . stats = stats ;
26+
2627 this . currentData = new ServerRegistries ( ) ;
2728 this . crawlTimer = null ;
2829 this . isCrawling = false ;
@@ -35,32 +36,32 @@ class RegistryCrawler {
3536 this . log = logv ;
3637 }
3738
38- /**
39- * Start the crawler with periodic updates
40- */
41- start ( ) {
42- if ( this . crawlTimer ) {
43- return ; // Already running
44- }
45-
46- // Initial crawl
47- this . crawl ( ) ;
48-
49- // Set up periodic crawling
50- this . crawlTimer = setInterval ( ( ) => {
51- this . crawl ( ) ;
52- } , this . config . crawlInterval ) ;
53- }
54-
55- /**
56- * Stop the crawler
57- */
58- stop ( ) {
59- if ( this . crawlTimer ) {
60- clearInterval ( this . crawlTimer ) ;
61- this . crawlTimer = null ;
62- }
63- }
39+ // / **
40+ // * Start the crawler with periodic updates
41+ // */
42+ // start() {
43+ // if (this.crawlTimer) {
44+ // return; // Already running
45+ // }
46+ //
47+ // // Initial crawl
48+ // this.crawl();
49+ //
50+ // // Set up periodic crawling
51+ // this.crawlTimer = setInterval(() => {
52+ // this.crawl();
53+ // }, this.config.crawlInterval);
54+ // }
55+ //
56+ // / **
57+ // * Stop the crawler
58+ // */
59+ // stop() {
60+ // if (this.crawlTimer) {
61+ // clearInterval(this.crawlTimer);
62+ // this.crawlTimer = null;
63+ // }
64+ // }
6465
6566 /**
6667 * Main entry point - crawl the registry starting from the master URL
@@ -133,7 +134,8 @@ class RegistryCrawler {
133134 registry . name = registryConfig . name ;
134135 registry . authority = registryConfig . authority || '' ;
135136 registry . address = registryConfig . url ;
136-
137+ this . stats . task ( 'TxRegistry' , 'Checking: ' + registry . address ) ;
138+
137139 if ( ! registry . name ) {
138140 this . addLogEntry ( 'error' , 'No name provided for registry' , registryConfig . url ) ;
139141 return registry ;
0 commit comments