Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/quetoo/installer/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ private void onSync(final File file) {
* @param throwable The error.
*/
private void onError(final Throwable throwable) {
System.err.println("Error: " + throwable.getMessage());
throwable.printStackTrace(System.err);
System.exit(1);
}

/**
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/quetoo/installer/Main.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.quetoo.installer;

import io.reactivex.exceptions.UndeliverableException;
import io.reactivex.plugins.RxJavaPlugins;
import org.apache.commons.cli.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;

import java.io.IOException;
import java.net.SocketException;
import java.nio.file.Files;
import java.util.Properties;

Expand All @@ -24,6 +27,19 @@ public class Main {
*/
public static void main(String[] args) {

RxJavaPlugins.setErrorHandler(e -> {
if (e instanceof UndeliverableException) {
e = e.getCause();
}
if (e instanceof InterruptedException
|| e instanceof IOException
|| e instanceof SocketException) {
return;
}
Thread.currentThread().getUncaughtExceptionHandler()
.uncaughtException(Thread.currentThread(), e);
});

final var build = Option.builder("b")
.longOpt("build")
.hasArg()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/quetoo/installer/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Observable<Delta> delta(final Observable<Index> indices) {
* @return An Observable yielding the synchronized files.
*/
public Observable<File> sync(final Observable<Delta> deltas) {
return deltas.flatMap(delta -> delta.getIndex().getSync().sync(delta))
return deltas.concatMap(delta -> delta.getIndex().getSync().sync(delta))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're de-parallelizing this chain here. Is there any reason why? Just to have better clarity between binaries vs data or? I get that each sync() will run N requests in parallel...

.doOnNext(file -> {
if (file.getParentFile().equals(config.getBin())) {
file.setExecutable(true);
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/org/quetoo/installer/aws/S3Sync.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ private <T> T executeHttpRequest(final String path, final Map<String, String> pa
.append("https://")
.append(bucketName)
.append(".s3.amazonaws.com/")
.append(path.replace("+", "%2B"));
.append(path.replace("+", "%2B").replace(" ", "%20"));

if (!params.isEmpty()) {
url.append("?");
params.forEach((k, v) -> {
if (url.charAt(url.length() - 1) != '?') {
url.append("&");
}
url.append(k).append("=").append(v.replace("+", "%2B"));
url.append(k).append("=").append(v.replace("+", "%2B").replace(" ", "%20"));
});
}

Expand Down Expand Up @@ -200,7 +200,11 @@ public Observable<File> sync(final Delta delta) {
return Observable.fromIterable(delta)
.map(asset -> (S3Object) asset)
.flatMap(obj -> Observable.fromCallable(() -> sync(obj))
.subscribeOn(Schedulers.io()), 8);
.subscribeOn(Schedulers.io())
.onErrorResumeNext(e -> {
System.err.println("Failed to sync " + obj.getKey() + ": " + e.getMessage());
return Observable.empty();
}), 8);
}

@Override
Expand Down