Skip to content

Commit

Permalink
Dapr 1.13 is less tolerant of app downtime to keep timers.
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Souza <[email protected]>
  • Loading branch information
artursouza committed Feb 13, 2024
1 parent 14c1880 commit 1cf7325
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import static io.dapr.it.Retry.callWithRetry;
import static io.dapr.it.actors.MyActorTestUtils.fetchMethodCallLogs;
import static io.dapr.it.actors.MyActorTestUtils.validateMethodCalls;
import static io.dapr.it.actors.MyActorTestUtils.validateMessageContent;
import static io.dapr.it.actors.MyActorTestUtils.validateMethodCalls;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

public class ActorTimerRecoveryIT extends BaseIT {
Expand Down Expand Up @@ -82,21 +81,17 @@ public void timerRecoveryTest() throws Exception {

// Restarts app only.
runs.left.stop();

// Pause a bit to let placements settle.
logger.info("Pausing 12 seconds to let placements settle.");
Thread.sleep(Duration.ofSeconds(12).toMillis());

// Cannot sleep between app's stop and start since it can trigger unhealthy actor in runtime and lose timers.
// Timers will survive only if the restart is "quick" and survives the runtime's actor health check.
// Starting in 1.13, sidecar is more sensitive to an app restart and will not keep actors active for "too long".
runs.left.start();

logger.debug("Pausing 10 seconds to allow timer to fire");
Thread.sleep(10000);
final List<MethodEntryTracker> newLogs = new ArrayList<>();
callWithRetry(() -> {
newLogs.clear();
newLogs.addAll(fetchMethodCallLogs(proxy));
validateMethodCalls(newLogs, METHOD_NAME, 3);
}, 5000);
}, 10000);

// Check that the restart actually happened by confirming the old logs are not in the new logs.
for (MethodEntryTracker oldLog: logs) {
Expand Down

0 comments on commit 1cf7325

Please sign in to comment.