Skip to content

Commit

Permalink
chore: catch index creation errors (#33627)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored Oct 17, 2024
1 parent cc28ea2 commit a7a7aa5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/meteor/server/models/raw/BaseRaw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ export abstract class BaseRaw<

this.col = this.db.collection(this.collectionName, options?.collection || {});

void this.createIndexes().catch((e) => {
console.warn(`Some indexes for collection '${this.collectionName}' could not be created:\n\t${e.message}`);
});
void this.createIndexes();

this.preventSetUpdatedAt = options?.preventSetUpdatedAt ?? false;
}
Expand All @@ -93,7 +91,9 @@ export abstract class BaseRaw<
await this.pendingIndexes;
}

this.pendingIndexes = this.col.createIndexes(indexes) as unknown as Promise<void>;
this.pendingIndexes = this.col.createIndexes(indexes).catch((e) => {
console.warn(`Some indexes for collection '${this.collectionName}' could not be created:\n\t${e.message}`);
}) as unknown as Promise<void>;

void this.pendingIndexes.finally(() => {
this.pendingIndexes = undefined;
Expand Down

0 comments on commit a7a7aa5

Please sign in to comment.