fix papers import
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 39s Details

This commit is contained in:
Ladd Hoffman 2024-04-27 18:38:01 -05:00
parent 5e580768e9
commit 551e6dfa54
1 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ const ethers = require('ethers');
const crypto = require('crypto');
const Promise = require('bluebird');
const objectHash = require('object-hash');
const { authorAddresses, authorPrivKeys } = require('../util/db');
const { dao } = require('../util/contracts');
const write = require('./write');
@ -144,9 +145,10 @@ const importPaper = async (paper) => {
// The forum allows dangling citations to support this use case.
try {
const citedPost = await generatePost(citedPaper);
const citedPostHash = objectHash(citedPost);
return {
weightPPM: eachCitationWeightPercent,
targetPostId: citedPost.hash,
targetPostId: citedPostHash,
};
} catch (e) {
return null;
@ -171,6 +173,7 @@ const importPaper = async (paper) => {
});
// Add the post to the forum (on-chain)
console.log('addPostWithRetry', { authors, hash, citations });
const { alreadyAdded } = await addPostWithRetry(authors, hash, citations);
if (alreadyAdded) {
console.log(`Post already added for paper ${paperId}`);