Skip to content

Commit

Permalink
Reinstate timeout on getUserDevices call
Browse files Browse the repository at this point in the history
Turns out that this used to have a timeout of 1 second in the wasm
bindings, which it no longer does. Reinstate it here.
  • Loading branch information
richvdh committed Nov 30, 2023
1 parent 5df26bc commit 04b3353
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rust-crypto/rust-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,10 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
// To fix this, we explicitly call `.free` on each of the objects, which tells the rust code to drop the
// allocated memory and decrement the refcounts for the crypto store.

const userDevices: RustSdkCryptoJs.UserDevices = await this.olmMachine.getUserDevices(rustUserId);
// Wait for up to a second for any in-flight device list requests to complete.
// The reason for this isn't so much to avoid races (some level of raciness is
// inevitable for this method) but to make testing easier.
const userDevices: RustSdkCryptoJs.UserDevices = await this.olmMachine.getUserDevices(rustUserId, 1);
try {
const deviceArray: RustSdkCryptoJs.Device[] = userDevices.devices();
try {
Expand Down

0 comments on commit 04b3353

Please sign in to comment.