Skip to content

Commit

Permalink
Merge pull request #869 from europeana/feat/MET-6235-Debias-Stop-Poll…
Browse files Browse the repository at this point in the history
…ing-On-Close

MET-6235 Remove needless debias polling
  • Loading branch information
andyjmaclean authored Nov 19, 2024
2 parents 324100c + 8f94d34 commit 63e7e57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ export class DatasetInfoComponent extends SubscriptionManager {
})
);
} else {
this.cmpDebias.startPolling();
this.subs.push(this.modalConfirms.open(this.modalIdPrefix + this.modalIdDebias).subscribe());
const pollerId = this.cmpDebias.startPolling();
this.subs.push(
this.modalConfirms.open(this.modalIdPrefix + this.modalIdDebias).subscribe(() => {
console.log(this.cmpDebias.clearDataPollerByIdentifier(pollerId));
})
);
}
}
}
3 changes: 2 additions & 1 deletion projects/sandbox/src/app/debias/debias.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ describe('DebiasComponent', () => {
it('should poll the debias report', fakeAsync(() => {
expect(component.debiasReport).toBeFalsy();
component.datasetId = DebiasState.COMPLETED;
component.startPolling();
const pollerId = component.startPolling();
expect(pollerId).toBeTruthy();
tick(component.apiSettings.interval);
expect(component.debiasReport).toBeTruthy();
tick(component.apiSettings.interval);
Expand Down
3 changes: 2 additions & 1 deletion projects/sandbox/src/app/debias/debias.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class DebiasComponent extends DataPollingComponent {
/** startPolling
* begins the data poller for the debias data
**/
startPolling(): void {
startPolling(): string {
const pollerId = this.datasetId + '-debias-' + new Date().toISOString();

this.createNewDataPoller(
Expand All @@ -82,6 +82,7 @@ export class DebiasComponent extends DataPollingComponent {
},
pollerId
);
return pollerId;
}

/** closeDebiasInfo
Expand Down

0 comments on commit 63e7e57

Please sign in to comment.