diff --git a/client/src/components/History/model/syncCurrentHistoryToGalaxy.js b/client/src/components/History/model/syncCurrentHistoryToGalaxy.js index be7ce846c14..a161e981428 100644 --- a/client/src/components/History/model/syncCurrentHistoryToGalaxy.js +++ b/client/src/components/History/model/syncCurrentHistoryToGalaxy.js @@ -1,9 +1,11 @@ // Sync Galaxy store to legacy galaxy current history import { fromEvent } from "rxjs"; -import { map, filter, switchMap, pluck, distinctUntilChanged } from "rxjs/operators"; +import { map, filter, switchMap, pluck, distinctUntilChanged, retryWhen, take, delay } from "rxjs/operators"; + +export function syncCurrentHistoryToGalaxy(galaxy$, store, cfg = {}) { + const { retryPeriod = 500, retries = 20 } = cfg; -export function syncCurrentHistoryToGalaxy(galaxy$, store) { // prettier-ignore const historyId$ = galaxy$.pipe( pluck("currHistoryPanel"), @@ -14,6 +16,10 @@ export function syncCurrentHistoryToGalaxy(galaxy$, store) { map(() => panel.model.id) ); }), + retryWhen(err$ => err$.pipe( + delay(retryPeriod), + take(retries) + )), filter(Boolean), distinctUntilChanged() );