mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-07 16:34:06 +00:00
Add config for GQL requests cache (#228)
* Add config and a method to set cache control settings for GQL requests * Add option for max size in GQL cache config * Fix failing tests
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
//
|
||||
|
||||
import { BaseProvider } from '@ethersproject/providers';
|
||||
import { getCustomProvider, Database as BaseDatabase } from '@cerc-io/util';
|
||||
import { getCustomProvider, Database as BaseDatabase, ServerConfig } from '@cerc-io/util';
|
||||
import { EthClient } from '@cerc-io/ipld-eth-client';
|
||||
import { StorageLayout } from '@cerc-io/solidity-mapper';
|
||||
|
||||
import { EventData } from '../../src/utils';
|
||||
import { Database } from '../../src/database';
|
||||
import { Indexer, ServerConfig } from './indexer';
|
||||
import { Indexer } from './indexer';
|
||||
|
||||
const NETWORK_URL = 'http://127.0.0.1:8081';
|
||||
const IPLD_ETH_SERVER_GQL_URL = 'http://127.0.0.1:8082/graphql';
|
||||
@@ -72,7 +72,7 @@ export const getDummyGraphData = (): any => {
|
||||
|
||||
export const getTestDatabase = (): Database => {
|
||||
const baseDatabase = new BaseDatabase({ type: 'postgres' });
|
||||
const serverConfig = new ServerConfig();
|
||||
const serverConfig = {} as ServerConfig;
|
||||
return new Database(serverConfig, baseDatabase);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
BlockProgressInterface,
|
||||
EventInterface,
|
||||
SyncStatusInterface,
|
||||
ServerConfig as ServerConfigInterface,
|
||||
ServerConfig,
|
||||
ValueResult,
|
||||
ContractInterface,
|
||||
StateStatus,
|
||||
@@ -29,7 +29,7 @@ export class Indexer implements IndexerInterface {
|
||||
}
|
||||
|
||||
get serverConfig () {
|
||||
return new ServerConfig();
|
||||
return {} as ServerConfig;
|
||||
}
|
||||
|
||||
get storageLayoutMap (): Map<string, StorageLayout> {
|
||||
@@ -202,37 +202,3 @@ export class Indexer implements IndexerInterface {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export class ServerConfig implements ServerConfigInterface {
|
||||
host: string;
|
||||
port: number;
|
||||
mode: string;
|
||||
kind: string;
|
||||
checkpointing: boolean;
|
||||
checkpointInterval: number;
|
||||
subgraphPath: string;
|
||||
enableState: boolean;
|
||||
wasmRestartBlocksInterval: number;
|
||||
filterLogs: boolean;
|
||||
maxEventsBlockRange: number;
|
||||
clearEntitiesCacheInterval: number;
|
||||
skipStateFieldsUpdate: boolean;
|
||||
loadRelationsSequential: boolean;
|
||||
|
||||
constructor () {
|
||||
this.host = '';
|
||||
this.port = 0;
|
||||
this.mode = '';
|
||||
this.kind = '';
|
||||
this.checkpointing = false;
|
||||
this.checkpointInterval = 0;
|
||||
this.subgraphPath = '';
|
||||
this.enableState = false;
|
||||
this.wasmRestartBlocksInterval = 0;
|
||||
this.filterLogs = false;
|
||||
this.maxEventsBlockRange = 0;
|
||||
this.clearEntitiesCacheInterval = 0;
|
||||
this.skipStateFieldsUpdate = false;
|
||||
this.loadRelationsSequential = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user