Skip to content

Commit

Permalink
delete existing PDRs before recreating
Browse files Browse the repository at this point in the history
  • Loading branch information
kadamidev committed Jan 9, 2025
1 parent 60b9067 commit fa2f768
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions desci-server/src/scripts/fixPublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { logger as parentLogger } from '../logger.js';
import { redisClient } from '../redisClient.js';
import { publishSequencer, PublishServices } from '../services/PublishServices.js';
import { getIndexedResearchObjects } from '../theGraph.js';
import { hexToCid } from '../utils.js';
import { ensureUuidEndsWithDot, hexToCid } from '../utils.js';

import { invalidateByUuid } from './invalidate-redis-cache.js';

Expand Down Expand Up @@ -96,7 +96,12 @@ async function fixByNodeUuids({
cLogger.info(`[fixByNodeUuids] Fixing version: ${nodeVersIdx + 1}, with commitId: ${commitId}`);

if (createIjPublishStatusEntry) {
// Add IJ publishStatus entry for the commitId
// Add IJ publishStatus entry for the commitId + remove existing PDRs
const node = await prisma.node.findUnique({
where: { uuid: ensureUuidEndsWithDot(nodeUuid) },
select: { id: true },
});
await prisma.publicDataReference.deleteMany({ where: { nodeId: node.id } });
await addIjPublishStatusEntry({ commitId, version: nodeVersIdx + 1, nodeUuid, manifestCid });
}

Expand Down

0 comments on commit fa2f768

Please sign in to comment.