mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-06-02 11:26:18 +02:00
fix: Increase timeout for YT images from 5 seconds to 10
This commit is contained in:
parent
e88ec6af63
commit
c893cd4608
|
@ -1,7 +1,5 @@
|
|||
package app.revanced.integrations.shared.settings;
|
||||
|
||||
import android.preference.ListPreference;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -570,12 +570,11 @@ public final class AlternativeThumbnailsPatch {
|
|||
|
||||
boolean imageFileFound;
|
||||
try {
|
||||
Logger.printDebug(() -> "Verifying image: " + imageUrl);
|
||||
// This hooked code is running on a low priority thread, and it's slightly faster
|
||||
// to run the url connection thru the integrations thread pool which runs at the highest priority.
|
||||
final long start = System.currentTimeMillis();
|
||||
imageFileFound = Utils.submitOnBackgroundThread(() -> {
|
||||
final int connectionTimeoutMillis = 5000;
|
||||
final int connectionTimeoutMillis = 10000;
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(imageUrl).openConnection();
|
||||
connection.setConnectTimeout(connectionTimeoutMillis);
|
||||
connection.setReadTimeout(connectionTimeoutMillis);
|
||||
|
@ -593,7 +592,7 @@ public final class AlternativeThumbnailsPatch {
|
|||
}
|
||||
return false;
|
||||
}).get();
|
||||
Logger.printDebug(() -> "Alt verification took: " + (System.currentTimeMillis() - start) + "ms");
|
||||
Logger.printDebug(() -> "Verification took: " + (System.currentTimeMillis() - start) + "ms for image: " + imageUrl);
|
||||
} catch (ExecutionException | InterruptedException ex) {
|
||||
Logger.printInfo(() -> "Could not verify alt url: " + imageUrl, ex);
|
||||
imageFileFound = false;
|
||||
|
@ -657,7 +656,7 @@ public final class AlternativeThumbnailsPatch {
|
|||
? "" : fullUrl.substring(imageExtensionEndIndex);
|
||||
}
|
||||
|
||||
/** @noinspection SameParameterValue*/
|
||||
/** @noinspection SameParameterValue */
|
||||
String createStillsUrl(@NonNull ThumbnailQuality qualityToUse, boolean includeViewTracking) {
|
||||
// Images could be upgraded to webp if they are not already, but this fails quite often,
|
||||
// especially for new videos uploaded in the last hour.
|
||||
|
|
Loading…
Reference in New Issue
Block a user