Skip to content

Commit e15b23b

Browse files
chore(worker): Reduce logger verbosity (#1179)
1 parent fdb05c0 commit e15b23b

14 files changed

Lines changed: 46 additions & 47 deletions

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Add missing schema changes introduced in [#1170](https://github.com/sourcebot-dev/sourcebot/pull/1170). [#1176](https://github.com/sourcebot-dev/sourcebot/pull/1176)
1212
- Fixed blame gutter commit navigation to use the file path as it existed at the attributing commit, so clicking a blame line whose commit predates a rename resolves to the correct historical path. [#1178](https://github.com/sourcebot-dev/sourcebot/pull/1178)
1313

14+
### Changed
15+
- Reduced the log verbosity of the worker by changing various log messages from info to debug. [#1179](https://github.com/sourcebot-dev/sourcebot/pull/1179)
16+
1417
## [4.17.1] - 2026-05-04
1518

1619
### Added

packages/backend/src/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class Api {
4242
app.post(`/api/experimental/add-github-repo`, this.experimental_addGithubRepo.bind(this));
4343

4444
this.server = app.listen(PORT, () => {
45-
logger.info(`API server is running on port ${PORT}`);
45+
logger.debug(`API server is running on port ${PORT}`);
4646
});
4747
}
4848

packages/backend/src/azuredevops.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ async function getRepos(
291291
const results = await Promise.allSettled(repoList.map(async (repo) => {
292292
try {
293293
const [org, projectName, repoName] = repo.split('/');
294-
logger.info(`Fetching repository info for ${repo}...`);
294+
logger.debug(`Fetching repository info for ${repo}...`);
295295

296296
const { durationMs, data: result } = await measure(async () => {
297297
const fetchFn = async () => {
@@ -306,7 +306,7 @@ async function getRepos(
306306
return fetchWithRetry(fetchFn, repo, logger);
307307
});
308308

309-
logger.info(`Found info for repository ${repo} in ${durationMs}ms`);
309+
logger.debug(`Found info for repository ${repo} in ${durationMs}ms`);
310310
return {
311311
type: 'valid' as const,
312312
data: [result]

packages/backend/src/configManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ConfigManager {
2828
});
2929

3030
this.watcher.on('change', async () => {
31-
logger.info(`Config file ${configPath} changed. Syncing config.`);
31+
logger.debug(`Config file ${configPath} changed. Syncing config.`);
3232
try {
3333
await this.syncConfig(configPath);
3434
} catch (error) {
@@ -101,7 +101,7 @@ export class ConfigManager {
101101
});
102102

103103
if (connectionNeedsSyncing) {
104-
logger.info(`Change detected for connection '${key}' (id: ${connection.id}). Creating sync job.`);
104+
logger.debug(`Change detected for connection '${key}' (id: ${connection.id}). Creating sync job.`);
105105
await this.connectionManager.createJobs([connection]);
106106
}
107107
}
@@ -119,7 +119,7 @@ export class ConfigManager {
119119
});
120120

121121
for (const connection of deletedConnections) {
122-
logger.info(`Deleting connection with name '${connection.name}'. Connection ID: ${connection.id}`);
122+
logger.debug(`Deleting connection with name '${connection.name}'. Connection ID: ${connection.id}`);
123123
await this.db.connection.delete({
124124
where: {
125125
id: connection.id,

packages/backend/src/connectionManager.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class ConnectionManager {
137137
});
138138

139139
for (const job of jobs) {
140-
logger.info(`Scheduling job ${job.id} for connection ${job.connection.name} (id: ${job.connectionId})`);
140+
logger.debug(`Scheduling job ${job.id} for connection ${job.connection.name} (id: ${job.connectionId})`);
141141
await this.queue.add(
142142
'connection-sync-job',
143143
{
@@ -158,7 +158,7 @@ export class ConnectionManager {
158158
private async runJob(job: Job<JobPayload>): Promise<JobResult> {
159159
const { jobId, connectionName } = job.data;
160160
const logger = createJobLogger(jobId);
161-
logger.info(`Running connection sync job ${jobId} for connection ${connectionName} (id: ${job.data.connectionId})`);
161+
logger.debug(`Running connection sync job ${jobId} for connection ${connectionName} (id: ${job.data.connectionId})`);
162162

163163
const currentStatus = await this.db.connectionSyncJob.findUniqueOrThrow({
164164
where: {
@@ -261,7 +261,7 @@ export class ConnectionManager {
261261
}
262262
});
263263
const deleteDuration = performance.now() - deleteStart;
264-
logger.info(`Deleted all RepoToConnection records for connection ${connectionName} (id: ${job.data.connectionId}) in ${deleteDuration}ms`);
264+
logger.debug(`Deleted all RepoToConnection records for connection ${connectionName} (id: ${job.data.connectionId}) in ${deleteDuration}ms`);
265265

266266
const totalUpsertStart = performance.now();
267267
for (const repo of repoData) {
@@ -281,7 +281,7 @@ export class ConnectionManager {
281281
logger.debug(`Upserted repo ${repo.displayName} (id: ${repo.external_id}) in ${upsertDuration}ms`);
282282
}
283283
const totalUpsertDuration = performance.now() - totalUpsertStart;
284-
logger.info(`Upserted ${repoData.length} repos for connection ${connectionName} (id: ${job.data.connectionId}) in ${totalUpsertDuration}ms`);
284+
logger.debug(`Upserted ${repoData.length} repos for connection ${connectionName} (id: ${job.data.connectionId}) in ${totalUpsertDuration}ms`);
285285
}, { timeout: env.CONNECTION_MANAGER_UPSERT_TIMEOUT_MS });
286286

287287
return {
@@ -330,7 +330,7 @@ export class ConnectionManager {
330330
}
331331
}
332332

333-
logger.info(`Connection sync job ${job.id} for connection ${job.data.connectionName} (id: ${job.data.connectionId}) completed`);
333+
logger.debug(`Connection sync job ${job.id} for connection ${job.data.connectionName} (id: ${job.data.connectionId}) completed`);
334334

335335
this.promClient.activeConnectionSyncJobs.dec({ connection: connectionName });
336336
this.promClient.connectionSyncJobSuccessTotal.inc({ connection: connectionName });

packages/backend/src/ee/accountPermissionSyncer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export class AccountPermissionSyncer {
181181

182182
const config = await loadConfig(env.CONFIG_PATH);
183183

184-
logger.info(`Syncing permissions for ${account.provider} account (id: ${account.id}) for user ${account.user.email}...`);
184+
logger.debug(`Syncing permissions for ${account.provider} account (id: ${account.id}) for user ${account.user.email}...`);
185185

186186
// Ensure the OAuth token is fresh, refreshing it if it is expired or near expiry.
187187
// Throws and sets Account.tokenRefreshErrorMessage if the refresh fails.
@@ -370,7 +370,7 @@ export class AccountPermissionSyncer {
370370
}
371371
});
372372

373-
logger.info(`Permissions synced for ${account.provider} account (id: ${account.id}) for user ${account.user.email}`);
373+
logger.debug(`Permissions synced for ${account.provider} account (id: ${account.id}) for user ${account.user.email}`);
374374
}
375375

376376
private async onJobFailed(job: Job<AccountPermissionSyncJob> | undefined, err: Error) {

packages/backend/src/ee/auditLogPruner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class AuditLogPruner {
2323
return;
2424
}
2525

26-
logger.info(`Audit log pruner started. Retaining logs for ${env.SOURCEBOT_EE_AUDIT_RETENTION_DAYS} days.`);
26+
logger.debug(`Audit log pruner started. Retaining logs for ${env.SOURCEBOT_EE_AUDIT_RETENTION_DAYS} days.`);
2727

2828
// Run immediately on startup, then every 24 hours
2929
this.pruneOldAuditLogs();
@@ -41,7 +41,7 @@ export class AuditLogPruner {
4141
const cutoff = new Date(Date.now() - env.SOURCEBOT_EE_AUDIT_RETENTION_DAYS * ONE_DAY_MS);
4242
let totalDeleted = 0;
4343

44-
logger.info(`Pruning audit logs older than ${cutoff.toISOString()}...`);
44+
logger.debug(`Pruning audit logs older than ${cutoff.toISOString()}...`);
4545

4646
// Delete in batches to avoid long-running transactions
4747
while (true) {
@@ -63,9 +63,9 @@ export class AuditLogPruner {
6363
}
6464

6565
if (totalDeleted > 0) {
66-
logger.info(`Pruned ${totalDeleted} audit log records.`);
66+
logger.debug(`Pruned ${totalDeleted} audit log records.`);
6767
} else {
68-
logger.info('No audit log records to prune.');
68+
logger.debug('No audit log records to prune.');
6969
}
7070
}
7171
}

packages/backend/src/ee/repoPermissionSyncer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class RepoPermissionSyncer {
186186
throw new Error(`Repo ${id} not found`);
187187
}
188188

189-
logger.info(`Syncing permissions for repo ${repo.displayName}...`);
189+
logger.debug(`Syncing permissions for repo ${repo.displayName}...`);
190190

191191
const credentials = await getAuthCredentialsForRepo(repo, logger);
192192
if (!credentials) {
@@ -388,7 +388,7 @@ export class RepoPermissionSyncer {
388388
}
389389
});
390390

391-
logger.info(`Permissions synced for repo ${repo.displayName ?? repo.name}`);
391+
logger.debug(`Permissions synced for repo ${repo.displayName ?? repo.name}`);
392392
}
393393

394394
private async onJobFailed(job: Job<RepoPermissionSyncJob> | undefined, err: Error) {

packages/backend/src/ee/syncSearchContexts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export const syncSearchContexts = async (params: SyncSearchContextsParams) => {
205205
});
206206

207207
for (const context of deletedContexts) {
208-
logger.info(`Deleting search context with name '${context.name}'. ID: ${context.id}`);
208+
logger.debug(`Deleting search context with name '${context.name}'. ID: ${context.id}`);
209209
await db.searchContext.delete({
210210
where: {
211211
id: context.id,

packages/backend/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const prisma = new PrismaClient({
4141

4242
try {
4343
await redis.ping();
44-
logger.info('Connected to redis');
44+
logger.debug('Connected to redis');
4545
} catch (err: unknown) {
4646
logger.error('Failed to connect to redis. Error:', err);
4747
process.exit(1);

0 commit comments

Comments
 (0)