git.psu.edu will be upgraded to critical security release 13.7.4 Monday, 11/18 between 9 and 10pm. Please email support@git.psu.edu if you have trouble with anything Gitlab-related. Please see the git.psu.edu Yammer group for more information.

Commit d0096796 authored by Ryan Diehl's avatar Ryan Diehl

Merge branch 'feature/expire-request' into 'develop'

feat(rx): adds expireRequest operator

See merge request !40
parents 05aaa99e 573c5f34
Pipeline #113164 passed with stages
in 5 minutes and 6 seconds
export { httpRetryBackoff, HttpRetryBackoffConfig } from './lib/http-backoff';
export { expireRequest } from './lib/expire-request';
import { Observable, race, throwError, timer } from 'rxjs';
import { switchMapTo } from 'rxjs/operators';
export const expireRequest = (timeout: number) => <T>(source: Observable<T>): Observable<T> =>
race(
source,
timer(timeout).pipe(
switchMapTo(
throwError({ message: 'Error: request timeout expired', status: 504 })
)
)
);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment