diff --git a/CHANGELOG.md b/CHANGELOG.md index a121f0de..d6a45890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed issue with external source code links being broken for paths with spaces. [#364](https://github.com/sourcebot-dev/sourcebot/pull/364) +- Makes base retry indexing configuration configurable and move from a default of `5s` to `60s`. [#377](https://github.com/sourcebot-dev/sourcebot/pull/377) ## [4.5.0] - 2025-06-21 diff --git a/docs/docs/configuration/environment-variables.mdx b/docs/docs/configuration/environment-variables.mdx index a55d735d..86df22b4 100644 --- a/docs/docs/configuration/environment-variables.mdx +++ b/docs/docs/configuration/environment-variables.mdx @@ -25,6 +25,7 @@ The following environment variables allow you to configure your Sourcebot deploy | `REDIS_URL` | `redis://localhost:6379` |

Connection string of your Redis instance. By default, a Redis database is automatically provisioned at startup within the container.

| | `REDIS_REMOVE_ON_COMPLETE` | `0` |

Controls how many completed jobs are allowed to remain in Redis queues

| | `REDIS_REMOVE_ON_FAIL` | `100` |

Controls how many failed jobs are allowed to remain in Redis queues

| +| `REPO_SYNC_RETRY_BASE_SLEEP_SECONDS` | `60` |

The base sleep duration (in seconds) for exponential backoff when retrying repository sync operations that fail

| | `SHARD_MAX_MATCH_COUNT` | `10000` |

The maximum shard count per query

| | `SMTP_CONNECTION_URL` | `-` |

The url to the SMTP service used for sending transactional emails. See [this doc](/docs/configuration/transactional-emails) for more info.

| | `SOURCEBOT_ENCRYPTION_KEY` | Automatically generated at startup if no value is provided. Generated using `openssl rand -base64 24` |

Used to encrypt connection secrets and generate API keys.

| diff --git a/packages/backend/src/env.ts b/packages/backend/src/env.ts index d8beba19..6a97db21 100644 --- a/packages/backend/src/env.ts +++ b/packages/backend/src/env.ts @@ -48,6 +48,7 @@ export const env = createEnv({ CONFIG_PATH: z.string().optional(), CONNECTION_MANAGER_UPSERT_TIMEOUT_MS: numberSchema.default(300000), + REPO_SYNC_RETRY_BASE_SLEEP_SECONDS: numberSchema.default(60), }, runtimeEnv: process.env, emptyStringAsUndefined: true, diff --git a/packages/backend/src/repoManager.ts b/packages/backend/src/repoManager.ts index 50dc0478..7aebba13 100644 --- a/packages/backend/src/repoManager.ts +++ b/packages/backend/src/repoManager.ts @@ -337,7 +337,7 @@ export class RepoManager implements IRepoManager { throw error; } - const sleepDuration = 5000 * Math.pow(2, attempts - 1); + const sleepDuration = (env.REPO_SYNC_RETRY_BASE_SLEEP_SECONDS * 1000) * Math.pow(2, attempts - 1); logger.error(`Failed to sync repository ${repo.name} (id: ${repo.id}), attempt ${attempts}/${maxAttempts}. Sleeping for ${sleepDuration / 1000}s... Error: ${error}`); await new Promise(resolve => setTimeout(resolve, sleepDuration)); }