Skip to content

Commit

Permalink
fix: IDXR-42 delay traitsQueue by 30 seconds and other improvements (#…
Browse files Browse the repository at this point in the history
…1168)

fixes several queues issues
  • Loading branch information
justraman authored Jul 10, 2024
1 parent 0f9f260 commit 0b0f31a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/job-handlers/rarity-ranker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default async (job: Queue.Job<JobData>, done: Queue.DoneCallback) => {
await em.delete(TokenRarity, { collection: { id: job.data.collectionId } })

// save new token rarities
await em.save(tokenRanks)
await em.save(tokenRanks, { chunk: 1000 })

console.timeEnd('rarity-ranker')

Expand Down
2 changes: 1 addition & 1 deletion src/jobs/compute-traits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { redisConfig } from './common'
export type JobData = { collectionId: string }

export const traitsQueue = new Queue<JobData>('traitsQueue', {
defaultJobOptions: { delay: 10_000, attempts: 2, removeOnComplete: true },
defaultJobOptions: { delay: 30_000, attempts: 2, removeOnComplete: true },
redis: redisConfig,
settings: {
maxStalledCount: 3,
Expand Down
5 changes: 3 additions & 2 deletions src/jobs/process-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ export type JobData = { resourceId: string; type: 'token' | 'collection'; force:
export const metadataQueue = new Queue<JobData>('metadataQueue', {
defaultJobOptions: {
delay: 1000,
attempts: 3,
attempts: 4,
backoff: {
type: 'exponential',
delay: 4000,
delay: 5000,
},
removeOnComplete: true,
removeOnFail: true,
},
redis: redisConfig,
settings: {
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/util/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function fetchMetadata(url: string, job: Queue.Job) {
},
withCredentials: false,
timeout: 15000,
maxRedirects: url.startsWith('https://platform.production.enjinusercontent.com/') ? 3 : 1,
maxRedirects: url.startsWith('http://platform.production.enjinusercontent.com/') ? 3 : 2,
httpsAgent: new https.Agent({ keepAlive: true, rejectUnauthorized: false }),
})

Expand Down

0 comments on commit 0b0f31a

Please sign in to comment.