Skip to content

Commit

Permalink
Update transaction to its latest API
Browse files Browse the repository at this point in the history
  • Loading branch information
fdel-car committed Jan 25, 2023
1 parent 950dda7 commit 0546a82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/strapi/ee/index.js
Expand Up @@ -55,7 +55,8 @@ const init = (licenseDir, logger) => {
* Store the result in database to avoid unecessary requests, and will fallback to that in case of a network failure.
*/
const onlineUpdate = async ({ strapi }) => {
const transaction = await strapi.db.transaction();
const { get, commit, rollback } = await strapi.db.transaction();
const transaction = get();

try {
const storedInfo = await strapi.db
Expand Down Expand Up @@ -111,10 +112,10 @@ const onlineUpdate = async ({ strapi }) => {
await query.execute();
}

await transaction.commit();
await commit();
} catch (error) {
// Example of errors: SQLite does not support FOR UPDATE
await transaction.rollback();
await rollback();
}
};

Expand Down

0 comments on commit 0546a82

Please sign in to comment.