Skip to content

Commit 8fb3e3f

Browse files
committed
Change blacklist controller to take enableExpiry flag, only enable it for BaseURL blacklist
1 parent 7c1c77d commit 8fb3e3f

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/streaming/controllers/BlacklistController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function BlackListController(config) {
5959
}
6060

6161
const expiry = blacklistExpiry || settings.get().streaming.blacklistExpiryTime;
62-
if (expiry && expiry > 0) {
62+
if (config.enableExpiry && expiry && expiry > 0) {
6363
const timeoutId = setTimeout(() => {
6464
remove(entry);
6565
}, expiry * 1000);

src/streaming/utils/BaseURLSelector.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ function BaseURLSelector() {
5757
function setup() {
5858
serviceLocationBlacklistController = BlacklistController(context).create({
5959
updateEventName: Events.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,
60-
addBlacklistEventName: Events.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD
60+
addBlacklistEventName: Events.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD,
61+
enableExpiry: true
6162
});
6263

6364
basicSelector = BasicSelector(context).create({

test/unit/test/streaming/streaming.controllers.BlacklistController.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('BlacklistController', function () {
126126
});
127127

128128
it('should remove an entry after a content steering TTL blacklist expiry time has passed', () => {
129-
const config = { updateEventName: '' };
129+
const config = { updateEventName: '', enableExpiry: true };
130130
const blacklistController = BlacklistController(context).create(config);
131131
blacklistController.setContentSteeringBlacklistExpiry(60);
132132

@@ -139,7 +139,7 @@ describe('BlacklistController', function () {
139139
});
140140

141141
it('should remove an entry after a blacklist expiry time from settings has passed', () => {
142-
const config = { updateEventName: '' };
142+
const config = { updateEventName: '', enableExpiry: true };
143143
const blacklistController = BlacklistController(context).create(config);
144144
settings.update({streaming: { blacklistExpiryTime: 60 }});
145145

@@ -150,4 +150,14 @@ describe('BlacklistController', function () {
150150
clock.tick(30 * 1000);
151151
expect(blacklistController.contains(SERVICE_LOCATION)).to.be.false;
152152
});
153+
154+
it('should not remove any entry if enableExpiry is not set', () => {
155+
const config = { updateEventName: '' };
156+
const blacklistController = BlacklistController(context).create(config);
157+
settings.update({streaming: { blacklistExpiryTime: 60 }});
158+
159+
blacklistController.add(SERVICE_LOCATION);
160+
clock.tick(60 * 1000);
161+
expect(blacklistController.contains(SERVICE_LOCATION)).to.be.true;
162+
});
153163
});

0 commit comments

Comments
 (0)