RED-6420 - No refreshes anymore for new user notifications

This commit is contained in:
Valentin Mihai 2023-03-28 16:28:57 +03:00
parent 9124c1f284
commit d1e095ce6a

View File

@ -4,7 +4,8 @@ import { Observable } from 'rxjs';
import { HeadersConfiguration, List, RequiredParam, Validate } from '../utils';
import { map } from 'rxjs/operators';
const ROOT_CHANGES_KEY = 'root';
export const ROOT_CHANGES_KEY = 'root';
export const LAST_CHECKED_OFFSET = 15000;
export interface HeaderOptions {
readonly authorization?: boolean;
@ -23,7 +24,7 @@ export interface QueryParam {
*/
export abstract class GenericService<I> {
protected readonly _http = inject(HttpClient);
protected readonly _lastCheckedForChanges = new Map<string, string>([[ROOT_CHANGES_KEY, new Date().toISOString()]]);
protected readonly _lastCheckedForChanges = new Map<string, string>([[ROOT_CHANGES_KEY, new Date(Date.now() - LAST_CHECKED_OFFSET).toISOString()]]);
protected abstract readonly _defaultModelPath: string;
get<T = I[]>(): Observable<T>;
@ -144,6 +145,6 @@ export abstract class GenericService<I> {
}
protected _updateLastChanged(key = ROOT_CHANGES_KEY): void {
this._lastCheckedForChanges.set(key, new Date().toISOString());
this._lastCheckedForChanges.set(key, new Date(Date.now() - LAST_CHECKED_OFFSET).toISOString());
}
}