Skip to content

Commit 46b66ae

Browse files
refactor(reddit): replace verbose logging with summary statistics
- Remove individual 'skipping existing' log messages - Add summary with fetched/skipped/added counts at end of processing - Improve log readability and reduce spam
1 parent 76613e3 commit 46b66ae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/jobs/reddit.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export class RedditService {
4545

4646
async storeRedditJobPosts(posts: any[]): Promise<any[]> {
4747
const newJobs = [];
48+
let skippedCount = 0;
4849
this.logger.log(`Processing ${posts.length} Reddit post(s) for jobs table`);
4950
const subscriptions = await this.db.subscription.findMany();
5051
for (const post of posts) {
@@ -75,7 +76,7 @@ export class RedditService {
7576
// Check if job already exists - if so, skip it but continue processing others
7677
const exists = await this.jobService.jobExists(post.url);
7778
if (exists) {
78-
this.logger.log(`Skipping existing Reddit job ${post.url}`);
79+
skippedCount++;
7980
continue;
8081
}
8182
const upsertedJob = await this.jobService.upsertJob(jobInput);
@@ -97,6 +98,11 @@ export class RedditService {
9798
this.logger.error(`Error processing Reddit post ${post.url}:`, error);
9899
}
99100
}
101+
102+
this.logger.log(
103+
`Reddit jobs processed: ${posts.length} fetched, ${skippedCount} skipped (existing), ${newJobs.length} added`
104+
);
105+
100106
return newJobs;
101107
}
102108
}

0 commit comments

Comments
 (0)