@stream-io/video-client 1.44.2 → 1.44.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,6 +103,7 @@ export declare class StreamSfuClient {
103
103
  private readonly credentials;
104
104
  private readonly dispatcher;
105
105
  private readonly joinResponseTimeout;
106
+ private readonly subscriptionsConcurrencyTag;
106
107
  private networkAvailableTask;
107
108
  /**
108
109
  * Promise that resolves when the JoinResponse is received.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.44.2",
3
+ "version": "1.44.3",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "browser": "dist/index.browser.es.js",
@@ -37,6 +37,7 @@ import {
37
37
  promiseWithResolvers,
38
38
  SafePromise,
39
39
  } from './helpers/promise';
40
+ import { withoutConcurrency } from './helpers/concurrency';
40
41
  import { getTimers } from './timers';
41
42
  import { Tracer, TraceSlice } from './stats';
42
43
  import { SfuJoinError } from './errors';
@@ -164,6 +165,9 @@ export class StreamSfuClient {
164
165
  private readonly credentials: Credentials;
165
166
  private readonly dispatcher: Dispatcher;
166
167
  private readonly joinResponseTimeout: number;
168
+ private readonly subscriptionsConcurrencyTag = Symbol(
169
+ 'subscriptionsConcurrencyTag',
170
+ );
167
171
  private networkAvailableTask: PromiseWithResolvers<void> | undefined;
168
172
  /**
169
173
  * Promise that resolves when the JoinResponse is received.
@@ -391,15 +395,17 @@ export class StreamSfuClient {
391
395
  };
392
396
 
393
397
  updateSubscriptions = async (tracks: TrackSubscriptionDetails[]) => {
394
- await this.joinTask;
395
- return retryable(
396
- (invocationMeta) =>
397
- this.rpc.updateSubscriptions(
398
- { sessionId: this.sessionId, tracks },
399
- { invocationMeta },
400
- ),
401
- this.abortController.signal,
402
- );
398
+ return withoutConcurrency(this.subscriptionsConcurrencyTag, async () => {
399
+ await this.joinTask;
400
+ return retryable(
401
+ (invocationMeta) =>
402
+ this.rpc.updateSubscriptions(
403
+ { sessionId: this.sessionId, tracks },
404
+ { invocationMeta },
405
+ ),
406
+ this.abortController.signal,
407
+ );
408
+ });
403
409
  };
404
410
 
405
411
  setPublisher = async (data: Omit<SetPublisherRequest, 'sessionId'>) => {
@@ -44,6 +44,8 @@ export const retryable = async <
44
44
  let result: FinishedUnaryCall<I, O> | undefined = undefined;
45
45
  do {
46
46
  if (attempt > 0) await sleep(retryInterval(attempt));
47
+ if (signal?.aborted) throw new Error(signal.reason);
48
+
47
49
  try {
48
50
  result = await rpc({ attempt });
49
51
  } catch (err) {