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

remove transactions from model-layer "infix" functions #133

Open
coeit opened this issue Jun 22, 2020 · 1 comment
Open

remove transactions from model-layer "infix" functions #133

coeit opened this issue Jun 22, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@coeit
Copy link
Member

coeit commented Jun 22, 2020

Thanks to @framirez07 it became apparent that adding (or removing) more than 4 associated records in the add<Model> input argument for a to_many association will lead to a Operation Timeout Error.
This is because every associated record starts a transaction in the model-layer "infix" function inside a for await loop in the resolver, which causes the database (or sequelize) to do a Timeout.

To fix this bug remove the transactions from the model-layer infix functions in sql-models and sql-adapter by changing the add_ and remove_ functions as sketched below

NEW "infix" function

static async add_accessionId(measurement_id, accessionId) {
        let updated = await Measurement.update({
                accessionId: accessionId
            }, {
                where: {
                    measurement_id: measurement_id
                }
            })
        return updated;
    }

update respective unit tests

@coeit coeit added the bug Something isn't working label Jun 22, 2020
@framirez07
Copy link

Done in this commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants