File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,14 @@ async function initializeOpenTelemetry() {
147147 } catch ( err ) {
148148 logger . error ( 'Error shutting down OpenTelemetry SDK' , err )
149149 }
150+
151+ try {
152+ const { getPostHogClient } = await import ( '@/lib/posthog/server' )
153+ await getPostHogClient ( ) ?. shutdown ( )
154+ logger . info ( 'PostHog client shut down successfully' )
155+ } catch ( err ) {
156+ logger . error ( 'Error shutting down PostHog client' , err )
157+ }
150158 }
151159
152160 process . on ( 'SIGTERM' , shutdownHandler )
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ const logger = createLogger('PostHogServer')
66let _client : import ( 'posthog-node' ) . PostHog | null = null
77let _disabled = false
88
9+ export function getPostHogClient ( ) : import ( 'posthog-node' ) . PostHog | null {
10+ return getClient ( )
11+ }
12+
913function getClient ( ) : import ( 'posthog-node' ) . PostHog | null {
1014 if ( _disabled ) return null
1115 if ( _client ) return _client
You can’t perform that action at this time.
0 commit comments