Add repo_to_index check for zoekt scheduling service

What does this MR do and why?

Change the behavior of InitialIndexingEventWorker.

Before: Calls the IndexingTaskService on each project of a namespace which will create the indexing tasks for all the projects except empty projects. And move the index to initializing.

After: Create the pending Search::Zoekt::Repository records for all projects of a namespace. And move the index to initializing.

Create a new scheduling task repo_to_index_check that will perform the indexing for all pending or initializing zoekt_repositories. And move the zoekt_repository to initializing if the project is non empty repo and move to ready if the project is empty.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Query Plan

https://console.postgres.ai/shared/53a78e47-3645-4483-b611-26936af4e3ed

SELECT
    "zoekt_repositories"."id"
FROM
    "zoekt_repositories"
WHERE
    "zoekt_repositories"."state" IN (0, 1)
    AND "zoekt_repositories"."id" >= 79
ORDER BY
    "zoekt_repositories"."id" ASC
LIMIT 1 OFFSET 1000

Related to #500350 (closed)

Edited by Ravi Kumar

Merge request reports

Loading