Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process all tokens of collection on refresh metadata #1277

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/job-handlers/process-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,16 @@ export default async (job: Queue.Job<JobData>, done: Queue.DoneCallback) => {
await em.save(resource)

if (jobData.type === 'collection' && jobData.allTokens === true) {
const uri = attributes.find((a) => a.key === 'uri')
// eslint-disable-next-line no-console
console.log('Processing all tokens in collection', jobData.resourceId)

if (uri && uri.value.includes('{id}')) {
// eslint-disable-next-line no-console
console.log('Processing all tokens in collection', jobData.resourceId)
const batch = tokensInBatch(em, jobData.resourceId)

const batch = tokensInBatch(em, jobData.resourceId)

// eslint-disable-next-line no-restricted-syntax
for await (const tokens of batch) {
tokens.forEach((token) => {
processMetadata(token.id, 'token', true)
})
}
// eslint-disable-next-line no-restricted-syntax
for await (const tokens of batch) {
tokens.forEach((token) => {
processMetadata(token.id, 'token', true)
})
}
}
done(null, { id: jobData.resourceId })
Expand Down
Loading