Skip to content

Commit d95e54d

Browse files
committed
Make the AS pending transaction promise propagate errors
1 parent e268005 commit d95e54d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/appservice/Appservice.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class Appservice extends EventEmitter {
236236
private appServer: any;
237237
private intentsCache: LRU.LRUCache<string, Intent>;
238238
private eventProcessors: { [eventType: string]: IPreprocessor[] } = {};
239-
private pendingTransactions: { [txnId: string]: Promise<any> } = {};
239+
private pendingTransactions: { [txnId: string]: Promise<void> } = {};
240240

241241
/**
242242
* Creates a new application service.
@@ -695,8 +695,7 @@ export class Appservice extends EventEmitter {
695695
}
696696

697697
LogService.info("Appservice", "Processing transaction " + txnId);
698-
// eslint-disable-next-line no-async-promise-executor
699-
this.pendingTransactions[txnId] = new Promise<void>(async (resolve) => {
698+
this.pendingTransactions[txnId] = Promise.resolve((async () => {
700699
// Process all the crypto stuff first to ensure that future transactions (if not this one)
701700
// will decrypt successfully. We start with EDUs because we need structures to put counts
702701
// and such into in a later stage, and EDUs are independent of crypto.
@@ -891,9 +890,7 @@ export class Appservice extends EventEmitter {
891890
this.emit("room.upgraded", event['room_id'], event);
892891
}
893892
}
894-
895-
resolve();
896-
});
893+
})());
897894

898895
try {
899896
await this.pendingTransactions[txnId];

0 commit comments

Comments
 (0)