mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
fix(worker): Use indexTimeoutMs setting for job timeout (#567)
This commit is contained in:
parent
4ebe4e0475
commit
03999f0de0
2 changed files with 6 additions and 5 deletions
|
|
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed "dubious ownership" errors when cloning / fetching repos. [#553](https://github.com/sourcebot-dev/sourcebot/pull/553)
|
- Fixed "dubious ownership" errors when cloning / fetching repos. [#553](https://github.com/sourcebot-dev/sourcebot/pull/553)
|
||||||
- Fixed issue with Ask Sourcebot tutorial re-appearing after restarting the browser. [#563](https://github.com/sourcebot-dev/sourcebot/pull/563)
|
- Fixed issue with Ask Sourcebot tutorial re-appearing after restarting the browser. [#563](https://github.com/sourcebot-dev/sourcebot/pull/563)
|
||||||
|
- Fixed `repoIndexTimeoutMs` not being used for index job timeouts. [#567](https://github.com/sourcebot-dev/sourcebot/pull/567)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Improved search performance for unbounded search queries. [#555](https://github.com/sourcebot-dev/sourcebot/pull/555)
|
- Improved search performance for unbounded search queries. [#555](https://github.com/sourcebot-dev/sourcebot/pull/555)
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ type JobPayload = {
|
||||||
repoName: string;
|
repoName: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const JOB_TIMEOUT_MS = 1000 * 60 * 60 * 6; // 6 hour indexing timeout
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the lifecycle of repository data on disk, including git working copies
|
* Manages the lifecycle of repository data on disk, including git working copies
|
||||||
* and search index shards. Handles both indexing operations (cloning/fetching repos
|
* and search index shards. Handles both indexing operations (cloning/fetching repos
|
||||||
|
|
@ -49,7 +47,7 @@ export class RepoIndexManager {
|
||||||
this.queue = new Queue<JobPayload>({
|
this.queue = new Queue<JobPayload>({
|
||||||
redis,
|
redis,
|
||||||
namespace: 'repo-index-queue',
|
namespace: 'repo-index-queue',
|
||||||
jobTimeoutMs: JOB_TIMEOUT_MS,
|
jobTimeoutMs: this.settings.repoIndexTimeoutMs,
|
||||||
maxAttempts: 3,
|
maxAttempts: 3,
|
||||||
logger: env.DEBUG_ENABLE_GROUPMQ_LOGGING === 'true',
|
logger: env.DEBUG_ENABLE_GROUPMQ_LOGGING === 'true',
|
||||||
});
|
});
|
||||||
|
|
@ -82,6 +80,8 @@ export class RepoIndexManager {
|
||||||
|
|
||||||
private async scheduleIndexJobs() {
|
private async scheduleIndexJobs() {
|
||||||
const thresholdDate = new Date(Date.now() - this.settings.reindexIntervalMs);
|
const thresholdDate = new Date(Date.now() - this.settings.reindexIntervalMs);
|
||||||
|
const timeoutDate = new Date(Date.now() - this.settings.repoIndexTimeoutMs);
|
||||||
|
|
||||||
const reposToIndex = await this.db.repo.findMany({
|
const reposToIndex = await this.db.repo.findMany({
|
||||||
where: {
|
where: {
|
||||||
AND: [
|
AND: [
|
||||||
|
|
@ -115,7 +115,7 @@ export class RepoIndexManager {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
createdAt: {
|
createdAt: {
|
||||||
gt: thresholdDate,
|
gt: timeoutDate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -124,7 +124,7 @@ export class RepoIndexManager {
|
||||||
{
|
{
|
||||||
AND: [
|
AND: [
|
||||||
{ status: RepoIndexingJobStatus.FAILED },
|
{ status: RepoIndexingJobStatus.FAILED },
|
||||||
{ completedAt: { gt: thresholdDate } },
|
{ completedAt: { gt: timeoutDate } },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue