Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(loops): defer only the job whose batch check throws

Richie McIlroy759645463b08
diff --git a/packages/database/loops/worker.ts b/packages/database/loops/worker.ts
index 39d37c0fd..4b2e42271 100644
--- a/packages/database/loops/worker.ts
+++ b/packages/database/loops/worker.ts
@@ -173,15 +173,22 @@ function unchangedUntil(
customerCopy: CustomerCopy,
now: Date,
) {
- if (!source || identityChanged(job, source) || needsStripeCustomer(source))
+ try {
+ if (!source || identityChanged(job, source) || needsStripeCustomer(source))
+ return null;
+ const { localProfile, hash } = syncFingerprint(
+ job,
+ source,
+ config,
+ customerCopy,
+ );
+ return job.profileHash === hash
+ ? nextProfileCheck(localProfile, now)
+ : null;
+ } catch {
+ // The per-job path hits the same error and defers only this job.
return null;
- const { localProfile, hash } = syncFingerprint(
- job,
- source,
- config,
- customerCopy,
- );
- return job.profileHash === hash ? nextProfileCheck(localProfile, now) : null;
+ }
}
export function loopsRuntimeConfig(env: NodeJS.ProcessEnv): LoopsRuntimeConfig {