From 3369f835bcb2434a6d54db34b0345f196aa2506d Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 3 Jan 2022 14:37:16 +0100 Subject: Avoid clearing config response queue There have been races due to the fact that we used to clear the queue when receiving a response, thus missing some of the responses. This stops clearing the queue and handles several items on the queue by polling until the queue is empty when a new item is found on the queue. --- .../com/yahoo/config/subscription/GenericConfigSubscriberTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'config/src/test') diff --git a/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java b/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java index fc922cc3b07..61573fd19be 100644 --- a/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java @@ -33,7 +33,7 @@ public class GenericConfigSubscriberTest { public void testSubscribeGeneric() throws InterruptedException { JRTConfigRequester requester = new JRTConfigRequester(new MockConnection(), tv); GenericConfigSubscriber sub = new GenericConfigSubscriber(requester); - final List defContent = List.of("myVal int"); + List defContent = List.of("myVal int"); GenericConfigHandle handle = sub.subscribe(new ConfigKey<>("simpletypes", "id", "config"), defContent, tv); @@ -46,9 +46,9 @@ public class GenericConfigSubscriberTest { assertFalse(handle.isChanged()); // Wait some time, config should be the same, but generation should be higher - Thread.sleep(tv.getFixedDelay() * 2); + Thread.sleep(tv.getFixedDelay() * 3); assertEquals("{}", getConfig(handle)); - assertTrue(handle.getRawConfig().getGeneration() > 1); + assertTrue("Unexpected generation (not > 1): " + handle.getRawConfig().getGeneration(), handle.getRawConfig().getGeneration() > 1); assertFalse(sub.nextConfig(false)); assertFalse(handle.isChanged()); } -- cgit v1.2.3