mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 05:06:53 +00:00
Offload account lock updates to accountLockExecutor
This commit is contained in:
1 parent
b924dea045
commit
480abebf7e
6 files changed
+32
-17
No files matched your search
+3
-3
@@ -51,7 +51,7 @@ class AccountLockManagerTest {
|
||||
|
||||
@Test
|
||||
void withLock() throws InterruptedException {
|
||||
accountLockManager.withLock(List.of(FIRST_NUMBER, SECOND_NUMBER), () -> {});
|
||||
accountLockManager.withLock(List.of(FIRST_NUMBER, SECOND_NUMBER), () -> {}, executor);
|
||||
|
||||
verify(lockClient, times(2)).acquireLock(any());
|
||||
verify(lockClient, times(2)).releaseLock(any(ReleaseLockOptions.class));
|
||||
@@ -61,7 +61,7 @@ class AccountLockManagerTest {
|
||||
void withLockTaskThrowsException() throws InterruptedException {
|
||||
assertThrows(RuntimeException.class, () -> accountLockManager.withLock(List.of(FIRST_NUMBER, SECOND_NUMBER), () -> {
|
||||
throw new RuntimeException();
|
||||
}));
|
||||
}, executor));
|
||||
|
||||
verify(lockClient, times(2)).acquireLock(any());
|
||||
verify(lockClient, times(2)).releaseLock(any(ReleaseLockOptions.class));
|
||||
@@ -71,7 +71,7 @@ class AccountLockManagerTest {
|
||||
void withLockEmptyList() {
|
||||
final Runnable task = mock(Runnable.class);
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> accountLockManager.withLock(Collections.emptyList(), () -> {}));
|
||||
assertThrows(IllegalArgumentException.class, () -> accountLockManager.withLock(Collections.emptyList(), () -> {}, executor));
|
||||
verify(task, never()).run();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ class AccountsManagerConcurrentModificationIntegrationTest {
|
||||
task.run();
|
||||
|
||||
return null;
|
||||
}).when(accountLockManager).withLock(any(), any());
|
||||
}).when(accountLockManager).withLock(any(), any(), any());
|
||||
|
||||
when(accountLockManager.withLockAsync(any(), any(), any())).thenAnswer(invocation -> {
|
||||
final Supplier<CompletableFuture<?>> taskSupplier = invocation.getArgument(1);
|
||||
|
||||
+1
-1
@@ -203,7 +203,7 @@ class AccountsManagerTest {
|
||||
task.run();
|
||||
|
||||
return null;
|
||||
}).when(accountLockManager).withLock(any(), any());
|
||||
}).when(accountLockManager).withLock(any(), any(), any());
|
||||
|
||||
when(accountLockManager.withLockAsync(any(), any(), any())).thenAnswer(invocation -> {
|
||||
final Supplier<CompletableFuture<?>> taskSupplier = invocation.getArgument(1);
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ class AccountsManagerUsernameIntegrationTest {
|
||||
task.run();
|
||||
|
||||
return null;
|
||||
}).when(accountLockManager).withLock(any(), any());
|
||||
}).when(accountLockManager).withLock(any(), any(), any());
|
||||
|
||||
when(accountLockManager.withLockAsync(any(), any(), any())).thenAnswer(invocation -> {
|
||||
final Supplier<CompletableFuture<?>> taskSupplier = invocation.getArgument(1);
|
||||
|
||||
Reference in new issue
Block a user