-
Notifications
You must be signed in to change notification settings - Fork 4
549: renable refetch questionservice and add back to job queue #604
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
Conversation
|
/deploy |
|
The command to deploy to staging for the commit d5c33e3 has been triggered. View action run |
Greptile SummaryRefactored the incomplete question refetch mechanism to use a job queue pattern instead of directly fetching from LeetCode API Key Changes:
Architecture Improvement:
|
| Filename | Overview |
|---|---|
| src/main/java/com/patina/codebloom/scheduled/leetcode/RefetchIncompleteQuestionsService.java | Refactored scheduled service to create jobs instead of directly fetching question data, runs every 24 hours |
| src/main/java/com/patina/codebloom/common/db/repos/question/QuestionRepository.java | Added repository method to find incomplete questions without active jobs |
| src/main/java/com/patina/codebloom/common/db/repos/question/QuestionSqlRepository.java | Implemented SQL query to filter incomplete questions excluding those with INCOMPLETE or PROCESSING jobs |
Sequence Diagram
sequenceDiagram
participant Scheduler as Spring Scheduler
participant RIQS as RefetchIncompleteQuestionsService
participant QR as QuestionRepository
participant JR as JobRepository
participant DB as Database
participant LQPS as LeetcodeQuestionProcessService
participant LC as LeetcodeClient
Note over Scheduler,RIQS: Every 24 hours
Scheduler->>RIQS: @Scheduled trigger reFetchIncompleteQuestions()
RIQS->>QR: getAllIncompleteQuestionsWithNoJob()
QR->>DB: SELECT questions WHERE fields NULL AND no INCOMPLETE/PROCESSING job
DB-->>QR: Return incomplete questions
QR-->>RIQS: Return ArrayList<Question>
alt Questions found
loop For each incomplete question
RIQS->>RIQS: Log warning about incomplete question
RIQS->>JR: createJob(Job with INCOMPLETE status)
JR->>DB: INSERT into Job table
DB-->>JR: Return created job with timestamps
JR-->>RIQS: Job created
RIQS->>RIQS: Log job creation
end
else No questions
RIQS->>RIQS: Log "All questions complete"
end
Note over Scheduler,LQPS: Every 30 minutes (separate process)
Scheduler->>LQPS: @Scheduled trigger drainQueue()
LQPS->>JR: findIncompleteJobs(maxSize)
JR->>DB: SELECT incomplete jobs ordered by nextAttemptAt
DB-->>JR: Return jobs
JR-->>LQPS: Return List<Job>
loop For each job
LQPS->>JR: updateJob(status=PROCESSING)
JR->>DB: UPDATE Job status
LQPS->>QR: getQuestionById(questionId)
QR->>DB: SELECT question
DB-->>QR: Return question
QR-->>LQPS: Return Question
LQPS->>LC: findSubmissionDetailBySubmissionId()
LC-->>LQPS: Return submission details
LQPS->>QR: updateQuestion(with fetched data)
QR->>DB: UPDATE Question
LQPS->>JR: updateJob(status=COMPLETE)
JR->>DB: UPDATE Job status
end
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
|
|
|
/deploy |
|
The command to deploy to staging for the commit 17726a5 has been triggered. View action run |
|
|
|
549
Description of changes
In this PR, I re-enabled the
RefetchIncompleteQuestionsServiceto check every 24 hours for any questions with incomplete fields + a job with a status ofINCOMPLETEorPROCESSING.Checklist before review
Screenshots
Dev
The images show the incomplete question (with id starting with 4f) being found by our scheduled task and then being added to the job queue where it is then processed.



Difficult to test in staging.
Staging