Add support for AttachmentBackfill sync messages.

This commit is contained in:
Greyson Parrelli
2025-02-13 11:46:09 -05:00
parent e1511a09a7
commit 754d759d7d
18 changed files with 781 additions and 229 deletions

View File

@@ -42,6 +42,7 @@ public abstract class Job {
private long lastRunAttemptTime;
private long nextBackoffInterval;
private volatile boolean cascadingFailure;
private volatile boolean canceled;
protected Context context;
@@ -106,6 +107,16 @@ public abstract class Job {
this.canceled = true;
}
/** Indicates that this job is failing because a job earlier in the chain failed. */
final void markCascadingFailure() {
this.cascadingFailure = true;
}
/** Whether or not this job is failing because a job earlier in the chain failed. */
protected boolean isCascadingFailure() {
return this.cascadingFailure;
}
/** Provides a default exponential backoff given the current run attempt. */
protected final long defaultBackoff() {
return BackoffUtil.exponentialBackoff(runAttempt + 1, RemoteConfig.getDefaultMaxBackoff());

View File

@@ -145,7 +145,10 @@ class JobController {
List<Job> dependents = onFailure(job);
job.setContext(application);
job.onFailure();
Stream.of(dependents).forEach(Job::onFailure);
for (Job child : dependents) {
child.markCascadingFailure();
child.onFailure();
}
return;
}

View File

@@ -535,18 +535,6 @@ public class JobManager implements ConstraintObserver.Notifier {
return this;
}
public Chain after(@NonNull Job job) {
return after(Collections.singletonList(job));
}
public Chain after(@NonNull List<? extends Job> jobs) {
if (!jobs.isEmpty()) {
this.jobs.add(0, new ArrayList<>(jobs));
}
return this;
}
public void enqueue() {
jobManager.enqueueChain(this);
}