*Update force to bypassCache

This commit is contained in:
Derrick Hammer 2022-08-18 19:29:06 -04:00
parent 8c16ad5469
commit b37b3052ec
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 4 deletions

View File

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