Fix flaky test with transactions (#7187)
* Fix flaky test with transactions * Add CHANGELOG entry * Fix the other transactions related tests that became flaky because now Parse Server tries to submit the transaction multilpe times in the case of TransientError * Remove fit from tests
This commit is contained in:
committed by
GitHub
parent
9a9fc5fa5f
commit
a430d6f7b7
@@ -1046,9 +1046,20 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
}
|
||||
|
||||
commitTransactionalSession(transactionalSection: any): Promise<void> {
|
||||
return transactionalSection.commitTransaction().then(() => {
|
||||
transactionalSection.endSession();
|
||||
});
|
||||
const commit = retries => {
|
||||
return transactionalSection
|
||||
.commitTransaction()
|
||||
.catch(error => {
|
||||
if (error && error.hasErrorLabel('TransientTransactionError') && retries > 0) {
|
||||
return commit(retries - 1);
|
||||
}
|
||||
throw error;
|
||||
})
|
||||
.then(() => {
|
||||
transactionalSection.endSession();
|
||||
});
|
||||
};
|
||||
return commit(5);
|
||||
}
|
||||
|
||||
abortTransactionalSession(transactionalSection: any): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user