Fix bulk finder

This commit is contained in:
Chocobozzz 2024-06-20 09:05:09 +02:00
parent 802601c241
commit 1b9b904c18
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 5 additions and 5 deletions

View File

@ -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 => {

View File

@ -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)),

View File

@ -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()) {