@@ -2,7 +2,7 @@ import { Job, Queue, Worker } from 'bullmq';
2
2
import { Redis } from 'ioredis' ;
3
3
import { createLogger } from "./logger.js" ;
4
4
import { Connection , PrismaClient , Repo , RepoToConnection , RepoIndexingStatus } from "@sourcebot/db" ;
5
- import { ConnectionConfig } from '@sourcebot/schemas/v3/connection.type' ;
5
+ import { GithubConnectionConfig , GitlabConnectionConfig , GiteaConnectionConfig } from '@sourcebot/schemas/v3/connection.type' ;
6
6
import { AppContext , Settings } from "./types.js" ;
7
7
import { captureEvent } from "./posthog.js" ;
8
8
import { getRepoPath , getTokenFromConfig , measure , getShardPrefix } from "./utils.js" ;
@@ -74,7 +74,7 @@ export class RepoManager implements IRepoManager {
74
74
const repos = await this . db . repo . findMany ( {
75
75
where : {
76
76
repoIndexingStatus : {
77
- notIn : [ RepoIndexingStatus . IN_INDEX_QUEUE , RepoIndexingStatus . FAILED ]
77
+ notIn : [ RepoIndexingStatus . IN_INDEX_QUEUE , RepoIndexingStatus . INDEXING , RepoIndexingStatus . FAILED ]
78
78
} ,
79
79
OR : [
80
80
{ indexedAt : null } ,
@@ -147,10 +147,15 @@ export class RepoManager implements IRepoManager {
147
147
return ;
148
148
}
149
149
150
+
150
151
let token : string | undefined ;
151
152
for ( const repoConnection of repoConnections ) {
152
153
const connection = repoConnection . connection ;
153
- const config = connection . config as unknown as ConnectionConfig ;
154
+ if ( connection . connectionType !== 'github' && connection . connectionType !== 'gitlab' && connection . connectionType !== 'gitea' ) {
155
+ continue ;
156
+ }
157
+
158
+ const config = connection . config as unknown as GithubConnectionConfig | GitlabConnectionConfig | GiteaConnectionConfig ;
154
159
if ( config . token ) {
155
160
token = await getTokenFromConfig ( config . token , connection . orgId , db ) ;
156
161
if ( token ) {
0 commit comments