Skip to content

Commit bdc85b4

Browse files
XiangRongLinTobiGr
andauthored
Add comments explaining the expiry field
Co-authored-by: Tobias Groza <TobiGr@users.noreply.github.com>
1 parent e98838a commit bdc85b4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ public static Disposable checkNewVersion(@NonNull final App app) {
179179
return null;
180180
}
181181

182+
// Check if the last request has happened a certain time ago
183+
// to reduce the number of API requests.
182184
final long expiry = prefs.getLong(app.getString(R.string.update_expiry_key), 0);
183185
if (!manager.isExpired(expiry)) {
184186
return null;
@@ -198,6 +200,8 @@ public static Disposable checkNewVersion(@NonNull final App app) {
198200
.subscribe(
199201
response -> {
200202
try {
203+
// Store a timestamp which needs to be exceeded,
204+
// before a new request to the API is made.
201205
final long newExpiry = manager
202206
.coerceExpiry(response.getHeader("expires"));
203207
prefs.edit()

0 commit comments

Comments
 (0)