From 8c2f857c55ef6e4049c0c5e56b9a0f091f24e076 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 4 Dec 2022 06:36:18 -0500 Subject: [PATCH] *Add cache bypass support for simple query --- src/query/simple.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/query/simple.ts b/src/query/simple.ts index d1eb62c..ca05ccf 100644 --- a/src/query/simple.ts +++ b/src/query/simple.ts @@ -9,6 +9,7 @@ import { RpcQueryOptions } from "../types.js"; import { clearTimeout, setTimeout } from "timers"; import b4a from "b4a"; import { + hashQuery, isPromise, validateResponse, validateTimestampedResponse, @@ -51,6 +52,19 @@ export default class SimpleRpcQuery extends RpcQueryBase { const rpc = new RPC(socket); + if (this._query.bypassCache) { + delete this._query.bypassCache; + await this.queryRpc(rpc, { + module: "rpc", + method: "clear_cached_item", + data: hashQuery(this._query), + }); + } + + if ("bypassCache" in this._query) { + delete this._query.bypassCache; + } + try { await this.queryRpc(rpc, this._query); } catch (e: any) {