Skip to content

Commit

Permalink
Merge pull request #563 from desci-labs/deprecate/publish-task-queue
Browse files Browse the repository at this point in the history
deprecate old publish flow
  • Loading branch information
hubsmoke authored Oct 11, 2024
2 parents 40cf43b + 51e78ca commit 761b10c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
41 changes: 20 additions & 21 deletions desci-server/src/controllers/nodes/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,24 @@ export const publish = async (req: PublishRequest, res: Response<PublishResBody>

if (task) return res.status(400).json({ error: 'Node publishing in progress' });

let publishTask: PublishTaskQueue | undefined;
let dpidAlias: number;
if (useNewPublish) {
logger.info({ ceramicStream, commitId, uuid, owner: owner.id }, 'Triggering new publish flow');
dpidAlias = await syncPublish(ceramicStream, commitId, node, owner, cid, uuid, manifest);
} else {
publishTask = await prisma.publishTaskQueue.create({
data: {
cid,
dpid: manifest.dpid?.id,
userId: owner.id,
transactionId,
ceramicStream,
commitId,
uuid: ensureUuidEndsWithDot(uuid),
status: PublishTaskQueueStatus.WAITING,
},
});
}
// let publishTask: PublishTaskQueue | undefined;
logger.info({ ceramicStream, commitId, uuid, owner: owner.id }, 'Triggering new publish flow');
const dpidAlias = await syncPublish(ceramicStream, commitId, node, owner, cid, uuid, manifest);
// if (useNewPublish) {
// } else {
// publishTask = await prisma.publishTaskQueue.create({
// data: {
// cid,
// dpid: manifest.dpid?.id,
// userId: owner.id,
// transactionId,
// ceramicStream,
// commitId,
// uuid: ensureUuidEndsWithDot(uuid),
// status: PublishTaskQueueStatus.WAITING,
// },
// });
// }

saveInteraction(
req,
Expand All @@ -154,7 +153,7 @@ export const publish = async (req: PublishRequest, res: Response<PublishResBody>
ceramicStream,
commitId,
uuid: ensureUuidEndsWithDot(uuid),
status: PublishTaskQueueStatus.WAITING,
// status: PublishTaskQueueStatus.WAITING,
},
owner.id,
);
Expand Down Expand Up @@ -182,7 +181,7 @@ export const publish = async (req: PublishRequest, res: Response<PublishResBody>
return res.send({
ok: true,
dpid: dpidAlias ?? parseInt(manifest.dpid?.id),
taskId: publishTask?.id,
// taskId: publishTask?.id,
});
} catch (err) {
logger.error({ err }, '[publish::publish] node-publish-err');
Expand Down
4 changes: 1 addition & 3 deletions desci-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class AppServer {
});

// init publish worker
this.#initWorker();
// this.#initWorker();
}

get httpServer() {
Expand Down Expand Up @@ -249,8 +249,6 @@ class AppServer {
}

async #initWorker() {
// TODO: remove after testing
// await Promise.all([runWorkerUntilStopped(), runWorkerUntilStopped()]);
await runWorkerUntilStopped();
}
}
Expand Down

0 comments on commit 761b10c

Please sign in to comment.