Skip to content

v12.6.7

Latest

Choose a tag to compare

@clevercloud-ci clevercloud-ci released this 22 Oct 15:28
· 7 commits to master since this release
6c80d2a

Patch Changes

  • #244 cc6146a - Make the first reconnection of a stream wait initRetryTimeout, not initRetryTimeout × backoffFactor

  • #244 5963f54 - Stop a stream with retries from reconnecting for ever when the response is not an event stream

    It now fails with SSE_INVALID_CONTENT_TYPE once its retries are spent, without firing onOpen().

  • #244 4c28e42 - Replace onError() and the error event of streams with onRetry()

    onError() was only ever called when the stream was about to reconnect, never for an error ending it, which still only rejects the promise start() returns. onRetry() is called at the same time with { error, retryCount, maxRetryCount, retryAt }, retryCount starting at 1:

    -stream.onError((error) => showReconnecting(error, stream.retryCount + 1));
    -stream.on('error', (event) => showReconnecting(event.data, stream.retryCount + 1));
    +stream.onRetry(({ error, retryCount }) => showReconnecting(error, retryCount));
  • #244 4c28e42 - pause() now works while a stream is connecting or retrying, and cancels the reconnection

    It can also be called from onOpen() and onRetry() listeners. It still throws on a stream not started yet, already paused or closed.

  • #244 6fc0102 - Keep a stream open when pause() and resume() are called in quick succession

    It could close instead, usually rejecting the promise start() returned with an AbortError.

  • #244 4c28e42 - stream.state is now retrying, not paused, while a stream waits to reconnect

    paused now only means the consumer paused the stream. Code reading paused as "reconnecting" must read retrying:

    -if (stream.state === 'paused') showReconnecting();
    +if (stream.state === 'retrying') showReconnecting();
  • #244 d4b08cd - Stop a stream from keeping a listener on the signal of its request at each reconnection