invoke request getPubkicKey on each endpoint read from communities table

This commit is contained in:
Claus-Peter Hübner 2023-01-04 00:19:38 +01:00
parent f227bb8d07
commit bac9d7bd4d
3 changed files with 3 additions and 6 deletions

View File

@ -10,7 +10,7 @@ Decimal.set({
})
const constants = {
DB_VERSION: '0058-add_communities_table',
DB_VERSION: '0059-add_verified_at_to communities',
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
LOG4JS_CONFIG: 'log4js-config.json',
// default log level on production should be info

View File

@ -43,8 +43,8 @@ export async function requestGetPublicKey(fdCom: FdCommunity): Promise<string |
return data.getPublicKey.publicKey
}
logger.warn(`requestGetPublicKey processed without response data`)
return undefined
} catch (err) {
logger.error(`Request-Error: ${JSON.stringify(err)}`)
}
return undefined
}

View File

@ -6,10 +6,7 @@ import { FdCommunity } from './graphql/1_0/model/FdCommunity'
export async function startValidateCommunities(timerInterval: number): Promise<void> {
while (true) {
const dbCommunities: DbCommunity[] = await DbCommunity.find({
where: [
{ verifiedAt: IsNull() },
{ verifiedAt: LessThan(Raw((lastAnnouncedAt) => `${lastAnnouncedAt}`)) },
],
where: [{ verifiedAt: IsNull() }, { verifiedAt: LessThan(`last_announced_at:`) }],
})
if (dbCommunities) {
dbCommunities.forEach(async function (dbCom) {