*Update force to bypassCache
This commit is contained in:
parent
8c16ad5469
commit
b37b3052ec
|
@ -41,7 +41,7 @@ let _aat: PocketAATObject;
|
||||||
let jsonServer: jayson.Server;
|
let jsonServer: jayson.Server;
|
||||||
|
|
||||||
interface RPCRequest {
|
interface RPCRequest {
|
||||||
force: boolean;
|
bypassCache: boolean;
|
||||||
chain: string;
|
chain: string;
|
||||||
query: string;
|
query: string;
|
||||||
data: string;
|
data: string;
|
||||||
|
@ -64,7 +64,7 @@ function getRequestId(request: RPCRequest) {
|
||||||
const clonedRequest = Object.assign({}, request);
|
const clonedRequest = Object.assign({}, request);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
delete clonedRequest.force;
|
delete clonedRequest.bypassCache;
|
||||||
|
|
||||||
return hash(stringify(clonedRequest));
|
return hash(stringify(clonedRequest));
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ async function processRequest(request: RPCRequest): Promise<RPCResponse> {
|
||||||
}
|
}
|
||||||
await lock.acquire();
|
await lock.acquire();
|
||||||
|
|
||||||
if (!request.force && processedRequests.get(reqId)) {
|
if (!request.bypassCache && processedRequests.get(reqId)) {
|
||||||
return processedRequests.get(reqId) as RPCResponse;
|
return processedRequests.get(reqId) as RPCResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ async function processRequest(request: RPCRequest): Promise<RPCResponse> {
|
||||||
: (rpcResp as unknown as JSONRPCResponseWithResult).result;
|
: (rpcResp as unknown as JSONRPCResponseWithResult).result;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!processedRequests.get(reqId) || request.force) &&
|
(!processedRequests.get(reqId) || request.bypassCache) &&
|
||||||
dbData.data?.error !== ERR_NOT_READY
|
dbData.data?.error !== ERR_NOT_READY
|
||||||
) {
|
) {
|
||||||
processedRequests.set(reqId, dbData);
|
processedRequests.set(reqId, dbData);
|
||||||
|
|
Loading…
Reference in New Issue