Fix: Repo embedding scheduler job routine as internal actor (#55698)

We received reports of repositories never getting scheduled for embedding jobs despite the
filter / pattern preview showing repos that match.

In both cases linked private repos appear to be impacted. After fetching
repo ids from `GetEmbeddableRepos` we then make another fetch for
getting the repo names for those repo ids. This read operation is where
we appear to end up missing out on some repos because we are not an
internal actor and therefore we must have
permissions to the repos that we want `List`ed. When we aren't authorized for any
repos then we end up never scheduling those repos since we never got the
repo names.
This commit is contained in:
Gary Lee 2023-08-09 17:10:16 -07:00 committed by GitHub
parent 4608be4136
commit ef63a4f9ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -55,6 +55,7 @@ All notable changes to Sourcegraph are documented in this file.
### Fixed
- Fixed a bug where user account requests could not be approved even though the license would permit user creation otherwise. [#55482](https://github.com/sourcegraph/sourcegraph/pull/55482)
- Fixed a bug where the background scheduler for embedding jobs based on policies would not schedule jobs for private repositories. [#55698](https://github.com/sourcegraph/sourcegraph/pull/55698)
### Removed

View File

@ -6,6 +6,7 @@ import (
"github.com/sourcegraph/sourcegraph/cmd/worker/job"
workerdb "github.com/sourcegraph/sourcegraph/cmd/worker/shared/init/db"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/embeddings"
@ -36,10 +37,9 @@ func (r repoEmbeddingSchedulerJob) Routines(_ context.Context, observationCtx *o
return nil, err
}
ctx := context.Background()
workCtx := actor.WithInternalActor(context.Background())
return []goroutine.BackgroundRoutine{
newRepoEmbeddingScheduler(ctx, gitserver.NewClient(db), db, repo.NewRepoEmbeddingJobsStore(db)),
newRepoEmbeddingScheduler(workCtx, gitserver.NewClient(db), db, repo.NewRepoEmbeddingJobsStore(db)),
}, nil
}