Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed issue where the branch filter in the repos detail page would not return any results. [#851](https://github.com/sourcebot-dev/sourcebot/pull/851)
- Fixed issue where 5xx http errors would not be retried. [#855](https://github.com/sourcebot-dev/sourcebot/pull/855)

### Changed
- Changed the queuing behaviour for permission syncing to prioritize newly created accounts & repos. [#856](https://github.com/sourcebot-dev/sourcebot/pull/856)

## [4.10.25] - 2026-02-04

### Fixed
Expand Down
8 changes: 7 additions & 1 deletion packages/backend/src/ee/accountPermissionSyncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const logger = createLogger(LOG_TAG);
const createJobLogger = (jobId: string) => createLogger(`${LOG_TAG}:job:${jobId}`);

const QUEUE_NAME = 'accountPermissionSyncQueue';
const POLLING_INTERVAL_MS = 1000;

type AccountPermissionSyncJob = {
jobId: string;
Expand Down Expand Up @@ -103,7 +104,7 @@ export class AccountPermissionSyncer {
});

await this.schedulePermissionSync(accounts);
}, 1000 * 5);
}, POLLING_INTERVAL_MS);
}

public async dispose() {
Expand All @@ -122,6 +123,9 @@ export class AccountPermissionSyncer {
data: accounts.map(account => ({
accountId: account.id,
})),
include: {
account: true,
}
});

await this.queue.addBulk(jobs.map((job) => ({
Expand All @@ -132,6 +136,8 @@ export class AccountPermissionSyncer {
opts: {
removeOnComplete: env.REDIS_REMOVE_ON_COMPLETE,
removeOnFail: env.REDIS_REMOVE_ON_FAIL,
// Priority 1 (high) for never-synced, Priority 2 (normal) for re-sync
priority: job.account.permissionSyncedAt === null ? 1 : 2,
}
})))
}
Expand Down
10 changes: 8 additions & 2 deletions packages/backend/src/ee/repoPermissionSyncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ type RepoPermissionSyncJob = {
}

const QUEUE_NAME = 'repoPermissionSyncQueue';

const POLLING_INTERVAL_MS = 1000;
const LOG_TAG = 'repo-permission-syncer';

const logger = createLogger(LOG_TAG);
const createJobLogger = (jobId: string) => createLogger(`${LOG_TAG}:job:${jobId}`);

Expand Down Expand Up @@ -107,7 +108,7 @@ export class RepoPermissionSyncer {
});

await this.schedulePermissionSync(repos);
}, 1000 * 5);
}, POLLING_INTERVAL_MS);
}

public async dispose() {
Expand All @@ -126,6 +127,9 @@ export class RepoPermissionSyncer {
data: repos.map(repo => ({
repoId: repo.id,
})),
include: {
repo: true,
}
});

await this.queue.addBulk(jobs.map((job) => ({
Expand All @@ -136,6 +140,8 @@ export class RepoPermissionSyncer {
opts: {
removeOnComplete: env.REDIS_REMOVE_ON_COMPLETE,
removeOnFail: env.REDIS_REMOVE_ON_FAIL,
// Priority 1 (high) for never-synced, Priority 2 (normal) for re-sync
priority: job.repo.permissionSyncedAt === null ? 1 : 2,
}
})))
}
Expand Down