Skip to content

Commit 4c0b595

Browse files
committed
feat: stagger cell fetches 8s apart; apply same stagger on connectivity restored
1 parent 1a1f5c9 commit 4c0b595

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/com/bpmct/trmnl_nook_simple_touch/ShowcaseActivity.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private boolean anyCacheExists() {
373373
private static final long WIFI_WARMUP_MS = 15 * 1000;
374374
private final android.os.Handler handler = new android.os.Handler();
375375

376-
private static final long CELL_FETCH_STAGGER_MS = 1500;
376+
private static final long CELL_FETCH_STAGGER_MS = 8000;
377377

378378
private void startFetchAll() {
379379
if (isConnected()) {
@@ -521,7 +521,14 @@ public void onReceive(android.content.Context context, Intent intent) {
521521
handler.post(new Runnable() {
522522
public void run() {
523523
hideNoWifiScreen();
524-
for (int i = 0; i < NUM_CELLS; i++) fetchCell(i);
524+
for (int i = 0; i < NUM_CELLS; i++) {
525+
final int cellIdx = i;
526+
handler.postDelayed(new Runnable() {
527+
public void run() {
528+
if (isCellConfigured(ShowcaseActivity.this, cellIdx)) fetchCell(cellIdx);
529+
}
530+
}, cellIdx * CELL_FETCH_STAGGER_MS);
531+
}
525532
}
526533
});
527534
}

0 commit comments

Comments
 (0)