Skip to content

Commit c95d786

Browse files
committed
revert mongo changes
1 parent 479e82c commit c95d786

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

spec/Idempotency.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('Idempotency', () => {
1212
runs only every 60s, so it can take up to 119s until entry removal - ain't nobody got time for that */
1313
const SIMULATE_TTL = true;
1414
const ttl = 2;
15+
const maxTimeOut = 4000;
1516

1617
// Helpers
1718
async function deleteRequestEntry(reqId) {
@@ -86,7 +87,7 @@ describe('Idempotency', () => {
8687
if (SIMULATE_TTL) {
8788
await deleteRequestEntry('abc-123');
8889
} else {
89-
await new Promise(resolve => setTimeout(resolve, 10));
90+
await new Promise(resolve => setTimeout(resolve, maxTimeOut));
9091
}
9192
await expectAsync(request(params)).toBeResolved();
9293
expect(counter).toBe(2);

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ export class MongoStorageAdapter implements StorageAdapter {
666666
mongoFieldNames.forEach(fieldName => {
667667
indexCreationRequest[fieldName] = options.indexType !== undefined ? options.indexType : 1;
668668
});
669-
const dropIndex = options.dropIndex !== undefined ? options.dropIndex : false;
670669
const defaultOptions: Object = { background: true, sparse: true };
671670
const indexNameOptions: Object = indexName ? { name: indexName } : {};
672671
const ttlOptions: Object = options.ttl !== undefined ? { expireAfterSeconds: options.ttl } : {};
@@ -679,13 +678,7 @@ export class MongoStorageAdapter implements StorageAdapter {
679678
...indexNameOptions,
680679
...ttlOptions,
681680
};
682-
const promises = [];
683-
if (dropIndex) {
684-
const promise = this.dropIndex(className, indexName);
685-
promises.push(promise);
686-
}
687-
return Promise.all(promises)
688-
.then(() => this._adaptiveCollection(className))
681+
return this._adaptiveCollection(className)
689682
.then(
690683
collection =>
691684
new Promise((resolve, reject) =>

src/Controllers/DatabaseController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ class DatabaseController {
17621762

17631763
const options = this.idempotencyOptions;
17641764
if (this.adapter instanceof MongoStorageAdapter) {
1765-
options.dropIndex = false;
1765+
options.ttl = 0;
17661766
} else if (this.adapter instanceof PostgresStorageAdapter) {
17671767
options.setIdempodencyTrigger = true;
17681768
}

0 commit comments

Comments
 (0)