Skip to content

Commit 5c1de52

Browse files
fix: remove early stop logic in Reddit job fetching to process all new jobs
Previously, the service would stop processing all jobs after encountering the first existing job, preventing new jobs from being added to the database. Now it skips existing jobs but continues processing the rest.
1 parent bc1ad79 commit 5c1de52

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/jobs/reddit.service.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,11 @@ export class RedditService {
7272
data: post,
7373
},
7474
};
75-
// EARLY STOP: if this job already exists we assume all subsequent
76-
// posts are older (API returns newest first) and can stop processing.
75+
// Check if job already exists - if so, skip it but continue processing others
7776
const exists = await this.jobService.jobExists(post.url);
7877
if (exists) {
79-
this.logger.log(`Encountered existing Reddit job ${post.url}; stopping further processing.`);
80-
break;
78+
this.logger.log(`Skipping existing Reddit job ${post.url}`);
79+
continue;
8180
}
8281
const upsertedJob = await this.jobService.upsertJob(jobInput);
8382
// Send notifications for new jobs

0 commit comments

Comments
 (0)