Files
rr3-apk/decompiled-community/sources/com/helpshift/poller/PollerController.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

69 lines
2.7 KiB
Java

package com.helpshift.poller;
import com.helpshift.log.HSLogger;
import com.helpshift.user.UserManager;
import com.helpshift.util.SafeWrappedRunnable;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/* loaded from: classes3.dex */
public class PollerController {
public ExponentialBackoff exponentialBackoff;
public boolean isRunning;
public FetchNotificationUpdate pollFunction;
public ScheduledThreadPoolExecutor scheduledThreadPoolExecutor;
public boolean shouldStop;
public UserManager userManager;
public PollerController(FetchNotificationUpdate fetchNotificationUpdate, UserManager userManager, ExponentialBackoff exponentialBackoff, ScheduledThreadPoolExecutor scheduledThreadPoolExecutor) {
this.pollFunction = fetchNotificationUpdate;
this.userManager = userManager;
this.exponentialBackoff = exponentialBackoff;
this.scheduledThreadPoolExecutor = scheduledThreadPoolExecutor;
}
public void start() {
this.shouldStop = false;
if (this.isRunning) {
return;
}
scheduleNextPoll(0);
this.isRunning = true;
}
public void stop() {
this.shouldStop = true;
this.isRunning = false;
this.exponentialBackoff.reset();
try {
this.scheduledThreadPoolExecutor.getQueue().clear();
} catch (Exception e) {
HSLogger.e("PolerCntlr", "Error in clearing the polling queue.", e);
}
}
public final void scheduleNextPoll(int i) {
if (this.shouldStop || !this.userManager.shouldPoll() || i == -1) {
HSLogger.d("PolerCntlr", "Stopping poller, shouldPoll is false or STOP_POLLING received.");
return;
}
this.exponentialBackoff.reconcileIntervals(this.userManager.getPollingBaseInterval(), this.userManager.getPollingMaxInterval());
int nextInterval = this.exponentialBackoff.nextInterval(i);
if (nextInterval == -1) {
HSLogger.d("PolerCntlr", "Stopping poller, request failed");
return;
}
HSLogger.d("PolerCntlr", "Scheduling next poll with interval: " + nextInterval);
try {
this.scheduledThreadPoolExecutor.schedule(new SafeWrappedRunnable(new Runnable() { // from class: com.helpshift.poller.PollerController.1
@Override // java.lang.Runnable
public void run() {
PollerController.this.scheduleNextPoll(PollerController.this.pollFunction.execute());
}
}), nextInterval, TimeUnit.MILLISECONDS);
} catch (Exception e) {
HSLogger.e("PolerCntlr", "Error in scheduling next poll", e);
}
}
}