mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Attempt to prevent message retry loops.
This commit is contained in:
@@ -76,6 +76,15 @@ class JobController {
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
void submitNewJobChains(@NonNull List<List<List<Job>>> chains) {
|
||||
synchronized (this) {
|
||||
for (List<List<Job>> chain : chains) {
|
||||
submitNewJobChain(chain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
void submitNewJobChain(@NonNull List<List<Job>> chain) {
|
||||
synchronized (this) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Allows the scheduling of durable jobs that will be run as early as possible.
|
||||
@@ -208,6 +209,24 @@ public class JobManager implements ConstraintObserver.Notifier {
|
||||
});
|
||||
}
|
||||
|
||||
public void addAllChains(@NonNull List<JobManager.Chain> chains) {
|
||||
if (chains.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Chain chain : chains) {
|
||||
for (List<Job> jobList : chain.getJobListChain()) {
|
||||
for (Job job : jobList) {
|
||||
jobTracker.onStateChange(job, JobTracker.JobState.PENDING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runOnExecutor(() -> {
|
||||
jobController.submitNewJobChains(chains.stream().map(Chain::getJobListChain).collect(Collectors.toList()));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins the creation of a job chain with a single job.
|
||||
* @see Chain
|
||||
|
||||
Reference in New Issue
Block a user