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 @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fixed incorrect shutdown of PostHog SDK in the worker. [#609](https://github.com/sourcebot-dev/sourcebot/pull/609)

## [4.9.1] - 2025-11-07

### Added
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { RepoPermissionSyncer } from './ee/repoPermissionSyncer.js';
import { AccountPermissionSyncer } from "./ee/accountPermissionSyncer.js";
import { PromClient } from './promClient.js';
import { RepoIndexManager } from "./repoIndexManager.js";
import { shutdownPosthog } from "./posthog.js";


const logger = createLogger('backend-entrypoint');
Expand Down Expand Up @@ -101,6 +102,7 @@ const cleanup = async (signal: string) => {

await prisma.$disconnect();
await redis.quit();
await shutdownPosthog();
}

process.on('SIGINT', () => cleanup('SIGINT').finally(() => process.exit(0)));
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/src/posthog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ export function captureEvent<E extends PosthogEvent>(event: E, properties: Posth
});
}

await posthog?.shutdown();
export async function shutdownPosthog() {
await posthog?.shutdown();
}
Loading