diff --git a/.env b/.env index 5e64c44..794b66e 100644 --- a/.env +++ b/.env @@ -5,5 +5,5 @@ DATABASE_USER=admin DATABASE_PASSWORD=admin QUERY_URL=http://127.0.0.1:4984 SCHEMA_CONFIG_ID=_design/sqlite:config -REPORT_DATABASE_URL=http://127.0.0.1:5984 -REPORT_DATABASE_NAME=app \ No newline at end of file + +CHANGES_POLL_INTERVAL=60000 \ No newline at end of file diff --git a/src/report-changes/storage/couchdb-changes.service.ts b/src/report-changes/storage/couchdb-changes.service.ts index e46e563..d8ec28e 100644 --- a/src/report-changes/storage/couchdb-changes.service.ts +++ b/src/report-changes/storage/couchdb-changes.service.ts @@ -39,6 +39,10 @@ export class CouchdbChangesService extends DatabaseChangesService { private databasePassword: string = this.configService.getOrThrow('DATABASE_PASSWORD'); + private changesPollInterval: number = Number( + this.configService.getOrThrow('CHANGES_POLL_INTERVAL'), + ); + private authHeaderValue: string; constructor( @@ -65,7 +69,9 @@ export class CouchdbChangesService extends DatabaseChangesService { filter((res) => res.last_seq !== lastSeq), tap((res) => (lastSeq = res.last_seq)), // poll regularly to get latest changes - repeat({ delay: 10000 }), + repeat({ + delay: this.changesPollInterval, + }), tap((res) => console.log('incoming couchdb changes', res)), );