mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-08 22:42:54 +00:00
feat: connection timeout
This commit is contained in:
committed by
Rainer Killinger
parent
945ae039eb
commit
cbc59795b7
@@ -12,7 +12,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {fromEvent, merge, ObservableInput, of, race, RetryConfig, share, Subject, takeUntil} from 'rxjs';
|
import {
|
||||||
|
delay,
|
||||||
|
fromEvent,
|
||||||
|
merge,
|
||||||
|
ObservableInput,
|
||||||
|
of,
|
||||||
|
race,
|
||||||
|
RetryConfig,
|
||||||
|
share,
|
||||||
|
Subject,
|
||||||
|
takeUntil,
|
||||||
|
} from 'rxjs';
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {filter, map, startWith, take, tap} from 'rxjs/operators';
|
import {filter, map, startWith, take, tap} from 'rxjs/operators';
|
||||||
import {NGXLogger} from 'ngx-logger';
|
import {NGXLogger} from 'ngx-logger';
|
||||||
@@ -43,6 +54,7 @@ export class InternetConnectionService {
|
|||||||
* registering itself.
|
* registering itself.
|
||||||
*/
|
*/
|
||||||
readonly retryConfig: RetryConfig = {
|
readonly retryConfig: RetryConfig = {
|
||||||
|
count: 5,
|
||||||
delay: this.doRetry.bind(this),
|
delay: this.doRetry.bind(this),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,6 +64,7 @@ export class InternetConnectionService {
|
|||||||
tap(it => console.log(it)),
|
tap(it => console.log(it)),
|
||||||
filter(it => !it),
|
filter(it => !it),
|
||||||
take(1),
|
take(1),
|
||||||
|
delay(Math.min(retryCount ** 4 + 100, 10_000)),
|
||||||
),
|
),
|
||||||
this.manualRetry$,
|
this.manualRetry$,
|
||||||
).pipe(
|
).pipe(
|
||||||
|
|||||||
Reference in New Issue
Block a user