Skip to content

Commit c2fe112

Browse files
author
ylexus
committed
async IntegrationTestUploadStarter that does not block the app from starting
1 parent 11ead21 commit c2fe112

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/test/java/net/yudichev/googlephotosupload/core/IntegrationTestUploadStarter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.nio.file.Path;
1212
import java.nio.file.Paths;
1313
import java.util.Optional;
14+
import java.util.concurrent.ForkJoinPool;
1415
import java.util.concurrent.atomic.AtomicBoolean;
1516
import java.util.concurrent.atomic.AtomicReference;
1617

@@ -47,14 +48,14 @@ public static void forgetUploadStateOnShutdown() {
4748

4849
@Override
4950
protected void doStart() {
50-
uploader.upload(ImmutableList.of(rootDir), resume)
51+
ForkJoinPool.commonPool().execute(() -> uploader.upload(ImmutableList.of(rootDir), resume)
5152
.whenComplete(logErrorOnFailure(logger, "Failed"))
5253
.whenComplete((aVoid, throwable) -> {
5354
lastFailure.set(throwable);
5455
if (forgetUploadStateOnShutdown.getAndSet(false)) {
5556
uploader.forgetUploadState();
5657
}
5758
applicationLifecycleControl.initiateShutdown();
58-
});
59+
}));
5960
}
6061
}

0 commit comments

Comments
 (0)