mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-09-11 21:47:09 +03:00
Fix bulk finder
This commit is contained in:
parent
802601c241
commit
1b9b904c18
@ -1,6 +1,6 @@
|
||||
import { uniq } from 'lodash-es'
|
||||
import { Observable, timer } from 'rxjs'
|
||||
import { buffer, distinctUntilChanged, filter, map, share, switchMap } from 'rxjs/operators'
|
||||
import { Observable } from 'rxjs'
|
||||
import { buffer, debounceTime, distinctUntilChanged, filter, map, share, switchMap } from 'rxjs/operators'
|
||||
|
||||
function buildBulkObservable <P extends number | string, R> (options: {
|
||||
notifierObservable: Observable<P>
|
||||
@ -11,7 +11,7 @@ function buildBulkObservable <P extends number | string, R> (options: {
|
||||
|
||||
return notifierObservable.pipe(
|
||||
distinctUntilChanged(),
|
||||
buffer(timer(time)),
|
||||
buffer(notifierObservable.pipe(debounceTime(time))),
|
||||
filter(params => params.length !== 0),
|
||||
map(params => uniq(params)),
|
||||
switchMap(params => {
|
||||
|
@ -39,7 +39,7 @@ export class UserSubscriptionService {
|
||||
) {
|
||||
this.existsObservable = merge(
|
||||
buildBulkObservable({
|
||||
time: 500,
|
||||
time: 200,
|
||||
notifierObservable: this.existsSubject,
|
||||
bulkGet: this.doSubscriptionsExist.bind(this)
|
||||
}).pipe(map(r => r.response)),
|
||||
|
@ -58,7 +58,7 @@ export class VideoPlaylistService {
|
||||
) {
|
||||
this.videoExistsInPlaylistObservable = merge(
|
||||
buildBulkObservable({
|
||||
time: 5000,
|
||||
time: 200,
|
||||
bulkGet: (videoIds: number[]) => {
|
||||
// We added a delay to the request, so ensure the user is still logged in
|
||||
if (this.auth.isLoggedIn()) {
|
||||
|
Loading…
Reference in New Issue
Block a user