Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Expose nodejs templates to django #28078

Merged
merged 3 commits into from
Jan 30, 2025
Merged

Conversation

benjackwhite
Copy link
Contributor

@benjackwhite benjackwhite commented Jan 30, 2025

Problem

We want to move to having all templates in the nodejs code. For now we need to support both python and nodejs based options.

Changes

Screenshot 2025-01-29 at 15 38 58
  • Utilize the nodejs api to load the templates
  • Merge them and cache them in the requester

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds proper cleanup functionality to the HogTransformer service to prevent flaky tests in PostHog's plugin server.

  • Added stop() method to HogTransformerService to properly cleanup resources via hogFunctionManager.stop()
  • Modified plugin-server/src/cdp/hog-transformations/hog-transformer.service.test.ts to use beforeEach/afterEach for consistent transformer lifecycle management
  • Added transformer cleanup to IngestionConsumer.stop() sequence with appropriate status logging
  • Replaced direct hogTransformer.start() calls with reloadAllHogFunctions() where only cache refresh is needed

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

})

afterEach(async () => {
await closeHub(hub)
await hogTransformer.stop()

jest.spyOn(hogTransformer['pluginExecutor'], 'execute')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Spy setup should happen before stop() to avoid potential race conditions

@benjackwhite benjackwhite enabled auto-merge (squash) January 30, 2025 11:32
@benjackwhite benjackwhite changed the title fix: Stopping of transformer service fix: Expose nodejs templates to django Jan 30, 2025
@benjackwhite benjackwhite disabled auto-merge January 30, 2025 11:33
@benjackwhite benjackwhite enabled auto-merge (squash) January 30, 2025 11:33
Copy link
Contributor

Size Change: 0 B

Total Size: 1.16 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.16 MB

compressed-size-action

@benjackwhite benjackwhite disabled auto-merge January 30, 2025 11:58
@benjackwhite benjackwhite merged commit 97c3f54 into master Jan 30, 2025
101 of 103 checks passed
@benjackwhite benjackwhite deleted the fix/hog-transform-stop branch January 30, 2025 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants