MCPcopy
hub / github.com/sequelize/sequelize / commit

Method commit

src/transaction.js:55–74  ·  view source on GitHub ↗

* Commit the transaction * * @returns {Promise}

()

Source from the content-addressed store, hash-verified

53 * @returns {Promise}
54 */
55 async commit() {
56 if (this.finished) {
57 throw new Error(`Transaction cannot be committed because it has been finished with state: ${this.finished}`);
58 }
59
60 try {
61 await this.sequelize.getQueryInterface().commitTransaction(this, this.options);
62 this.cleanup();
63 } catch (e) {
64 console.warn(`Committing transaction ${this.id} failed with error ${JSON.stringify(e.message)}. We are killing its connection as it is now in an undetermined state.`);
65 await this.forceCleanup();
66
67 throw e;
68 } finally {
69 this.finished = 'commit';
70 for (const hook of this._afterCommitHooks) {
71 await hook.apply(this, [this]);
72 }
73 }
74 }
75
76 /**
77 * Rollback (abort) the transaction

Callers 14

transactionMethod · 0.95
model.test.jsFile · 0.80
verifyDeadlockFunction · 0.80
newTransactionFuncFunction · 0.80
sequelize.test.jsFile · 0.80
create.test.jsFile · 0.80
json.test.jsFile · 0.80
transactFunction · 0.80
nestedTransactFunction · 0.80

Calls 6

cleanupMethod · 0.95
forceCleanupMethod · 0.95
commitTransactionMethod · 0.80
getQueryInterfaceMethod · 0.80
warnMethod · 0.65
stringifyMethod · 0.65

Tested by 3

verifyDeadlockFunction · 0.64
newTransactionFuncFunction · 0.64