Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fe 360 ngx jsonapi revisar tiempos #357

Open
wants to merge 1 commit into
base: v2.3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/service.ts
Original file line number Diff line number Diff line change
@@ -341,8 +341,10 @@ export class Service<R extends Resource = Resource> {
subject: BehaviorSubject<DocumentCollection<R>>
): void {
temporary_collection.setLoaded(false);
let old_time = Date.now()
Core.get(path.get()).subscribe(
success => {
console.log('Tiempo de espera en el metodo all ---->', (Date.now() - old_time))
// this create a new ID for every resource (for caching proposes)
// for example, two URL return same objects but with different attributes
if (params.cachehash) {
2 changes: 2 additions & 0 deletions src/sources/http.service.ts
Original file line number Diff line number Diff line change
@@ -21,12 +21,14 @@ export class Http {
Accept: 'application/vnd.api+json'
})
};
let old_time = Date.now()

// NOTE: prevent duplicate GET requests
if (method === 'get') {
if (!this.get_requests[path]) {
let obs: Observable<IDocumentData> = this.http.request<IDocumentData>(method, this.rsJsonapiConfig.url + path, req).pipe(
tap(() => {
console.log('El tiempo en el metodo original exec ----->', Date.now() - old_time)
delete this.get_requests[path];
}),
share()