From 5f2b7e6ff41c7cf7ceb0f08495942bff68181567 Mon Sep 17 00:00:00 2001 From: lastpeony Date: Wed, 27 Nov 2024 18:26:19 +0300 Subject: [PATCH] fix resetSubscribersConnectedStatus match count --- src/main/java/io/antmedia/datastore/db/MongoStore.java | 3 ++- src/test/java/io/antmedia/test/db/DBStoresUnitTest.java | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/antmedia/datastore/db/MongoStore.java b/src/main/java/io/antmedia/datastore/db/MongoStore.java index 7ec864df1..953a6ad78 100644 --- a/src/main/java/io/antmedia/datastore/db/MongoStore.java +++ b/src/main/java/io/antmedia/datastore/db/MongoStore.java @@ -1411,7 +1411,7 @@ public boolean resetSubscribersConnectedStatus() { executedQueryCount++; UpdateResult execute = subscriberDatastore.find(Subscriber.class).update(new UpdateOptions().multi(true), set("connected", false)); - result = execute.getMatchedCount() > 1; + result = execute.getMatchedCount() >= 1; if(result){ getSubscriberCache().getNativeCache().asMap().forEach((key, value) -> { @@ -1426,6 +1426,7 @@ public boolean resetSubscribersConnectedStatus() { }); } + } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); } diff --git a/src/test/java/io/antmedia/test/db/DBStoresUnitTest.java b/src/test/java/io/antmedia/test/db/DBStoresUnitTest.java index f30564353..35d269dda 100644 --- a/src/test/java/io/antmedia/test/db/DBStoresUnitTest.java +++ b/src/test/java/io/antmedia/test/db/DBStoresUnitTest.java @@ -294,7 +294,7 @@ public void testMongoStore() throws Exception { dataStore = new MongoStore("127.0.0.1", "", "", "testdb"); - /* + testSaveDuplicateStreamId((MongoStore)dataStore); testLocalLiveBroadcast(dataStore); @@ -346,8 +346,7 @@ public void testMongoStore() throws Exception { testGetSubtracks(dataStore); - testGetSubtracksWithStatus(dataStore);*/ - testTimeBasedSubscriberOperations(dataStore); + testGetSubtracksWithStatus(dataStore); testSubscriberCache(dataStore); @@ -2310,9 +2309,6 @@ public void testTimeBasedSubscriberOperations(DataStore store) { // isConnected should be true again assertTrue(store.isSubscriberConnected(subscriberPlay.getStreamId(), subscriberPlay.getSubscriberId())); - subscribers = store.listAllSubscribers(streamId, 0, 10); - - // reset connection status assertTrue(store.resetSubscribersConnectedStatus()); // connection status should false again