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

Use birpc #28

Merged
merged 7 commits into from
Apr 5, 2024
Merged

Use birpc #28

merged 7 commits into from
Apr 5, 2024

Conversation

codetheweb
Copy link
Contributor

Greatly simplifies code and paves the way for us to grab a new database instance within beforeTemplateIsBaked() in application code.

Greatly simplifies code and paves the way for us to grab a new database instance within `beforeTemplateIsBaked()` in application code.
@codetheweb codetheweb marked this pull request as ready for review April 4, 2024 19:11

let rpcCallback: (data: any) => void
const rpc = createBirpc<SharedWorkerFunctions, TestWorkerFunctions>(

Choose a reason for hiding this comment

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

is the idea meant to establish a bidirectional communication with the postgres docker container?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not quite

AVA's architecture has one worker thread per test file (called a test worker) and one worker thread per "shared worker" (called... a shared worker)

previous to this PR, we implemented 2-way RPC calls between the test worker and shared workers ourselves, but using birpc really makes the intent and logic cleaner

Choose a reason for hiding this comment

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

oh i see, this is to communicate with ava's worker thread

params: params as any,
connection: connectionDetails,
containerExec: async (command): Promise<ExecResult> =>
rpc.execCommandInContainer(command),

Choose a reason for hiding this comment

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

you weren't kidding this is definitely way simpler

src/index.ts Outdated Show resolved Hide resolved
@panzerchris
Copy link

Took me a while but this looks like a solid update!

@codetheweb codetheweb merged commit ffcbb79 into main Apr 5, 2024
8 checks passed
@codetheweb codetheweb deleted the feat-use-birpc branch April 5, 2024 17:09
github-actions bot pushed a commit that referenced this pull request Apr 5, 2024
# [7.2.0](v7.1.0...v7.2.0) (2024-04-05)

### Features

* Merge pull request [#28](#28) from seamapi/feat-use-birpc ([ffcbb79](ffcbb79))
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.

4 participants