Skip to content

[TRI-3867] Updating lots of environment variables at once fails with a transaction timeout #1411

Closed
@matt-aitken

Description

@matt-aitken

When we bulk upsert environment variables we wrap the entire thing in a database transaction. If there are a lot of env vars (e.g. more than 100) then the transaction can timeout.

You can see in the current code that the transaction is wrapped around the for loop:

const result = await $transaction(this.prismaClient, async (tx) => {

Instead we should move that transaction inside the for loop. We still need the transaction so we always create all the resources for each env var and don't leave any of them dangling.

TRI-3867

Metadata

Metadata

Assignees

No one assigned

    Labels

    UrgentCreated by Linear-GitHub SyncbugSomething isn't workinglinear

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions