Skip to content

Commit

Permalink
fix resetSubscribersConnectedStatus match count
Browse files Browse the repository at this point in the history
  • Loading branch information
lastpeony committed Nov 27, 2024
1 parent c1b0eb5 commit 5f2b7e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/main/java/io/antmedia/datastore/db/MongoStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) -> {
Expand All @@ -1426,6 +1426,7 @@ public boolean resetSubscribersConnectedStatus() {
});

}

} catch (Exception e) {
logger.error(ExceptionUtils.getStackTrace(e));
}
Expand Down
8 changes: 2 additions & 6 deletions src/test/java/io/antmedia/test/db/DBStoresUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void testMongoStore() throws Exception {

dataStore = new MongoStore("127.0.0.1", "", "", "testdb");

/*

testSaveDuplicateStreamId((MongoStore)dataStore);

testLocalLiveBroadcast(dataStore);
Expand Down Expand Up @@ -346,8 +346,7 @@ public void testMongoStore() throws Exception {


testGetSubtracks(dataStore);
testGetSubtracksWithStatus(dataStore);*/
testTimeBasedSubscriberOperations(dataStore);
testGetSubtracksWithStatus(dataStore);

testSubscriberCache(dataStore);

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5f2b7e6

Please sign in to comment.