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

Outbox prisma adapter #231

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Conversation

kamilwylegala
Copy link
Collaborator

Transactional outbox pattern adapter for Prisma.

@kamilwylegala kamilwylegala force-pushed the AP-5046-outbox-prisma-adapter branch from 9ffbf8c to 963014a Compare November 26, 2024 14:33
const prismaModel: PrismaClient[typeof this.modelName] = this.prisma[this.modelName]

for (const entry of entries) {
await prismaModel.upsert({
Copy link
Owner

@kibertoad kibertoad Nov 26, 2024

Choose a reason for hiding this comment

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

upserts often have suboptimal performance with plenty of locking, can we somehow simplify this to be bulk inserts and bulk updates?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely. I'm working on making tests green. Once I cover all cases, Bulk update/insert would do the job.

Actually upsert has some weird behavior, maybe let's switch to bulk inserts/updates right away.

): Promise<OutboxEntry<SupportedEvents[number]>> {
const prismaModel = this.prisma[this.modelName] as unknown as ModelDelegate

// @ts-ignore
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: remove it later, added now to just move forward with the CI and setting up tests there.

@kamilwylegala kamilwylegala marked this pull request as ready for review November 28, 2024 12:20
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