Skip to content

Commit

Permalink
run formatted again
Browse files Browse the repository at this point in the history
  • Loading branch information
kjelko committed Jan 16, 2025
1 parent 62e1e84 commit 551020e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
8 changes: 4 additions & 4 deletions packages/remote-config/src/client/caching_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class CachingClient implements RemoteConfigFetchClient {
private readonly storage: Storage,
private readonly storageCache: StorageCache,
private readonly logger: Logger
) { }
) {}

/**
* Returns true if the age of the cached fetched configs is less than or equal to
Expand Down Expand Up @@ -65,9 +65,9 @@ export class CachingClient implements RemoteConfigFetchClient {

this.logger.debug(
'Config fetch cache check.' +
` Cache age millis: ${cacheAgeMillis}.` +
` Cache max age millis (minimumFetchIntervalMillis setting): ${cacheMaxAgeMillis}.` +
` Is cache hit: ${isCachedDataFresh}.`
` Cache age millis: ${cacheAgeMillis}.` +
` Cache max age millis (minimumFetchIntervalMillis setting): ${cacheMaxAgeMillis}.` +
` Is cache hit: ${isCachedDataFresh}.`
);

return isCachedDataFresh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,3 @@ export interface FetchRequest {
*/
customSignals?: CustomSignals;
}

8 changes: 6 additions & 2 deletions packages/remote-config/src/client/rest_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
* limitations under the License.
*/

import { CustomSignals, FetchResponse, FirebaseRemoteConfigObject } from '../public_types';
import {
CustomSignals,
FetchResponse,
FirebaseRemoteConfigObject
} from '../public_types';
import {
RemoteConfigFetchClient,
FetchRequest
Expand Down Expand Up @@ -55,7 +59,7 @@ export class RestClient implements RemoteConfigFetchClient {
private readonly projectId: string,
private readonly apiKey: string,
private readonly appId: string
) { }
) {}

/**
* Fetches from the Remote Config REST API.
Expand Down
2 changes: 1 addition & 1 deletion packages/remote-config/src/client/retrying_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class RetryingClient implements RemoteConfigFetchClient {
constructor(
private readonly client: RemoteConfigFetchClient,
private readonly storage: Storage
) { }
) {}

async fetch(request: FetchRequest): Promise<FetchResponse> {
const throttleMetadata = (await this.storage.getThrottleMetadata()) || {
Expand Down
18 changes: 14 additions & 4 deletions packages/remote-config/src/storage/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ export class IndexedDbStorage extends Storage {
'custom_signals',
transaction
);
const updatedSignals = mergeCustomSignals(customSignals, storedSignals || {});
const updatedSignals = mergeCustomSignals(
customSignals,
storedSignals || {}
);
await this.setWithTransaction<CustomSignals>(
'custom_signals',
updatedSignals,
Expand Down Expand Up @@ -345,13 +348,20 @@ export class InMemoryStorage extends Storage {
}

async setCustomSignals(customSignals: CustomSignals): Promise<CustomSignals> {
const storedSignals = (this.storage['custom_signals'] || {}) as CustomSignals;
this.storage['custom_signals'] = mergeCustomSignals(customSignals, storedSignals);
const storedSignals = (this.storage['custom_signals'] ||
{}) as CustomSignals;
this.storage['custom_signals'] = mergeCustomSignals(
customSignals,
storedSignals
);
return Promise.resolve(this.storage['custom_signals'] as CustomSignals);
}
}

function mergeCustomSignals(customSignals: CustomSignals, storedSignals: CustomSignals): CustomSignals {
function mergeCustomSignals(
customSignals: CustomSignals,
storedSignals: CustomSignals
): CustomSignals {
const combinedSignals = {
...storedSignals,
...customSignals
Expand Down
2 changes: 1 addition & 1 deletion packages/remote-config/src/storage/storage_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Storage } from './storage';
* A memory cache layer over storage to support the SDK's synchronous read requirements.
*/
export class StorageCache {
constructor(private readonly storage: Storage) { }
constructor(private readonly storage: Storage) {}

/**
* Memory caches.
Expand Down
4 changes: 1 addition & 3 deletions packages/remote-config/test/remote_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import * as sinon from 'sinon';
import { StorageCache } from '../src/storage/storage_cache';
import { Storage } from '../src/storage/storage';
import { RemoteConfig } from '../src/remote_config';
import {
RemoteConfigFetchClient,
} from '../src/client/remote_config_fetch_client';
import { RemoteConfigFetchClient } from '../src/client/remote_config_fetch_client';
import { Value } from '../src/value';
import './setup';
import { ERROR_FACTORY, ErrorCode } from '../src/errors';
Expand Down

0 comments on commit 551020e

Please sign in to comment.