mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Minor cleanup, typo fix while testing.
Dropped a couple prettier-ignores that weren't doing much, but we can/should certainly continue to use this where the formatting is egregious.
This commit is contained in:
@@ -6,11 +6,11 @@ import { loadHistoryContents } from "../../caching";
|
||||
|
||||
// prettier-ignore
|
||||
export const loadContents = (cfg = {}) => {
|
||||
const {
|
||||
windowSize,
|
||||
initialInterval = 2 * 1000,
|
||||
maxInterval = 10 * initialInterval,
|
||||
disablePoll = false
|
||||
const {
|
||||
windowSize,
|
||||
initialInterval = 2 * 1000,
|
||||
maxInterval = 10 * initialInterval,
|
||||
disablePoll = false
|
||||
} = cfg;
|
||||
|
||||
return switchMap(([{ id }, params, hid]) => {
|
||||
|
||||
@@ -2,28 +2,19 @@
|
||||
import { of } from "rxjs";
|
||||
import { mergeMap, delay } from "rxjs/operators";
|
||||
|
||||
let decayCounter = 0;
|
||||
|
||||
// prettier-ignore
|
||||
export const decay = (cfg = {}) => {
|
||||
const {
|
||||
initialInterval,
|
||||
maxInterval = 60 * 1000,
|
||||
lambda = 0.25
|
||||
} = cfg;
|
||||
const { initialInterval, maxInterval = 60 * 1000, lambda = 0.25 } = cfg;
|
||||
|
||||
if (undefined === initialInterval) {
|
||||
throw new Error("provide an initialInterval to decay");
|
||||
}
|
||||
|
||||
let counter = 0;
|
||||
decayCounter++;
|
||||
|
||||
return mergeMap(val => {
|
||||
return mergeMap((val) => {
|
||||
let waitTime = Math.floor(initialInterval * Math.exp(lambda * counter++));
|
||||
waitTime = Math.max(waitTime, initialInterval);
|
||||
waitTime = Math.min(waitTime, maxInterval);
|
||||
console.log("decay time", decayCounter, waitTime);
|
||||
return of(val).pipe(delay(waitTime))
|
||||
return of(val).pipe(delay(waitTime));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ import { defer, Subject } from "rxjs";
|
||||
import { filter, finalize, share } from "rxjs/operators";
|
||||
|
||||
// global XHR request feed, emits every time xhr fires
|
||||
// prettier-ignore
|
||||
const xhr$ = defer(() => {
|
||||
const request$ = new Subject();
|
||||
|
||||
@@ -19,12 +18,10 @@ const xhr$ = defer(() => {
|
||||
XMLHttpRequest.prototype.open = originalOpen;
|
||||
})
|
||||
);
|
||||
}).pipe(
|
||||
share()
|
||||
);
|
||||
}).pipe(share());
|
||||
|
||||
/**
|
||||
* Watch outgong ajax calls for any of the indicated methods, filter to any of the provided route regexes
|
||||
* Watch outgoing ajax calls for any of the indicated methods, filter to any of the provided route regexes
|
||||
*
|
||||
* @param {Object} cfg Configure methods and routes to monitor
|
||||
* @return {Observable} Observable that emits every time a matching outgoing request happens
|
||||
|
||||
Reference in New Issue
Block a user