Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nastassia-dailidava committed Sep 9, 2024
1 parent 51c3967 commit ac24712
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public boolean clearSnapshot(T group) {
// we take a writeLock to prevent watches from being created
writeLock.lock();
try {

LOGGER.debug("Clearing snapshot for group {}", group);
// If we don't know about this group, do nothing.
if (statuses.hasStatuses(group)) {
LOGGER.warn("tried to clear snapshot for group with existing watches, group={}", group);
Expand Down Expand Up @@ -268,7 +268,10 @@ public DeltaWatch createDeltaWatch(
String version) {
long watchId = watchCount.incrementAndGet();
status.setWatch(watchId, watch);
watch.setStop(() -> status.removeWatch(watchId));
watch.setStop(() -> {
status.removeWatch(watchId);

});
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("open watch {} for {}[{}] from node {} for version {}",
watchId,
Expand Down Expand Up @@ -371,12 +374,6 @@ protected void respondWithSpecificOrder(T group,
String version = snapshot.version(watch.request().getResourceType(), watch.request().getResourceNamesList());

if (!watch.request().getVersionInfo().equals(version)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("responding to open watch {}[{}] with new version {}",
id,
String.join(", ", watch.request().getResourceNamesList()),
version);
}

respond(watch, snapshot, group);

Expand Down Expand Up @@ -413,12 +410,6 @@ protected void respondWithSpecificOrder(T group,
String version = snapshot.version(watch.request().getResourceType(), Collections.emptyList());

if (!watch.version().equals(version)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("responding to open watch {}[{}] with new version {}",
id,
String.join(", ", watch.trackedResources().keySet()),
version);
}

List<String> removedResources = snapshotRemovedResources.stream()
.filter(s -> watch.trackedResources().get(s) != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class SimpleCacheTest {
private static final String VERSION1 = UUID.randomUUID().toString();
protected static final String VERSION2 = UUID.randomUUID().toString();

private static final Snapshot SNAPSHOT1 = Snapshot.create(
public static final Snapshot SNAPSHOT1 = Snapshot.create(
ImmutableList.of(Cluster.newBuilder().setName(CLUSTER_NAME).build()),
ImmutableList.of(ClusterLoadAssignment.getDefaultInstance()),
ImmutableList.of(Listener.newBuilder().setName(LISTENER_NAME).build()),
Expand Down Expand Up @@ -95,7 +95,6 @@ public void invalidNamesListShouldReturnWatcherWithNoResponseInAdsMode() {
false,
false
);

assertThatWatchIsOpenWithNoResponses(new WatchAndTracker(watch, responseTracker));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import pl.allegro.tech.servicemesh.envoycontrol.utils.DirectScheduler
import pl.allegro.tech.servicemesh.envoycontrol.utils.ParallelScheduler
import pl.allegro.tech.servicemesh.envoycontrol.utils.ParallelizableScheduler
import pl.allegro.tech.servicemesh.envoycontrol.utils.any
import pl.allegro.tech.servicemesh.envoycontrol.v3.SimpleCacheTest
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import reactor.core.scheduler.Schedulers
Expand Down Expand Up @@ -160,6 +161,7 @@ class SnapshotUpdaterTest {
)

updater.startWithServices("existingService1", "existingService2")
println("snapshot1: " + SimpleCacheTest.SNAPSHOT1)

hasSnapshot(cache, allServicesGroup)
.hasOnlyClustersFor("existingService1", "existingService2")
Expand Down

0 comments on commit ac24712

Please sign in to comment.