Skip to content

Commit 7d8aab6

Browse files
committed
feat: update post score by queue
1 parent 0ee511e commit 7d8aab6

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

apps/cron/src/jobs/GenerateFeedJob.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ export class GenerateFeedJob extends JobProgress implements Job {
2222
const { fk_following_id, fk_post_id } = data
2323
try {
2424
await this.feedService.createFeed({ followingId: fk_following_id, postId: fk_post_id })
25-
await this.redis.lpop(feedQueueName)
26-
handledQueueCount++
2725
} catch (error) {
2826
console.log('Error occurred while creating feed', error)
2927
console.log('data', data)
30-
continue
28+
} finally {
29+
await this.redis.lpop(feedQueueName)
30+
handledQueueCount++
3131
}
3232
}
3333
console.log(`Created Feed Count: ${handledQueueCount}`)

apps/server/src/services/PostService/index.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -405,19 +405,7 @@ export class PostService implements Service {
405405
}
406406
}
407407
public async updatePostScore(postId: string) {
408-
console.log('upodatePostScore', postId)
409408
await this.redis.addToScorePostQueue({ post_id: postId })
410-
try {
411-
await axios.patch(
412-
`${ENV.cronHost}/api/posts/v1/score/${postId}`,
413-
{},
414-
{
415-
headers: {
416-
'Cron-Api-Key': ENV.cronApiKey,
417-
},
418-
},
419-
)
420-
} catch (_) {}
421409
}
422410
public shortDescription(post: Post): string {
423411
if (post.short_description) return post.short_description

0 commit comments

Comments
 (0)