Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: allow retrying rejected Loom queue dispatches

Richie McIlroy78b1cbadf2b8
diff --git a/apps/web/__tests__/unit/loom-import.test.ts b/apps/web/__tests__/unit/loom-import.test.ts
index 213676322..650581202 100644
--- a/apps/web/__tests__/unit/loom-import.test.ts
+++ b/apps/web/__tests__/unit/loom-import.test.ts
@@ -1716,6 +1716,34 @@ describe("resuming an uploaded concierge Loom file", () => {
expect(startVideoProcessingWorkflowMock).not.toHaveBeenCalled();
});
+ it("can resume after a confirmed queue rejection without querying its unqueued run", async () => {
+ whereMock
+ .mockReturnValueOnce(
+ withLimit([
+ {
+ ...recording,
+ metadata: {
+ loomImportRun: {
+ runId: "rejected-run",
+ dispatch: "rejected",
+ },
+ },
+ },
+ ]),
+ )
+ .mockReturnValueOnce(withLimit([uploaded]));
+ getRunMock.mockImplementation(() => {
+ throw new Error("Unqueued run is unavailable");
+ });
+ const { resumeConciergeLoomFileUpload } = await import("@/actions/loom");
+ await expect(resumeConciergeLoomFileUpload(input)).resolves.toEqual({
+ ok: true,
+ value: { status: "started" },
+ });
+ expect(getRunMock).not.toHaveBeenCalled();
+ expect(startLoomFileProcessingWorkflowMock).toHaveBeenCalledOnce();
+ });
+
it("processes a large uploaded file in its existing recording", async () => {
whereMock
.mockReturnValueOnce(withLimit([recording]))
diff --git a/apps/web/actions/loom.ts b/apps/web/actions/loom.ts
index 2af2a6018..b16184855 100644
--- a/apps/web/actions/loom.ts
+++ b/apps/web/actions/loom.ts
@@ -1301,7 +1301,7 @@ export async function resumeConciergeLoomFileUpload(input: {
throw new LoomMigrationError("The destination workspace needs Cap Pro.");
}
const previousRun = record.metadata?.loomImportRun;
- if (previousRun) {
+ if (previousRun && previousRun.dispatch !== "rejected") {
let status: string | null;
try {
status = await getRun(previousRun.runId).status;