fix: Cache SB stats up to 1 hour, or until the user creates a new segment

This commit is contained in:
LisoUseInAIKyrios 2025-05-05 22:45:06 +04:00
parent 98d2771db7
commit 30c8f86846
2 changed files with 3 additions and 1 deletions

View file

@ -14,7 +14,7 @@ public class UserStats {
/**
* How long to cache user stats objects.
*/
private static final long STATS_EXPIRATION_MILLISECONDS = 5 * 60 * 1000; // 5 minutes.
private static final long STATS_EXPIRATION_MILLISECONDS = 60 * 60 * 1000; // 60 minutes.
private final String privateUserId;
public final String publicUserId;

View file

@ -184,6 +184,8 @@ public class SBRequester {
Utils.showToastLong(str("revanced_sb_submit_failed_unknown_error", 0, ex.getMessage()));
} catch (Exception ex) {
Logger.printException(() -> "failed to submit segments", ex); // Should never happen.
} finally {
lastFetchedStats = null; // Fetch updated stats if needed.
}
}