mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2025-01-06 01:20:28 +05:30
Add timeout when fetching response from downloader.
This commit is contained in:
parent
665306b39f
commit
03da4db386
@ -12,6 +12,8 @@ import java.net.HttpCookie;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
public class DownloaderImpl extends Downloader {
|
public class DownloaderImpl extends Downloader {
|
||||||
|
|
||||||
@ -110,8 +112,8 @@ public class DownloaderImpl extends Downloader {
|
|||||||
}, Multithreading.getCachedExecutor());
|
}, Multithreading.getCachedExecutor());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return responseFuture.get();
|
return responseFuture.get(10, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user