*Add cache bypass support for simple query
This commit is contained in:
parent
6429bd513c
commit
8c2f857c55
|
@ -9,6 +9,7 @@ import { RpcQueryOptions } from "../types.js";
|
||||||
import { clearTimeout, setTimeout } from "timers";
|
import { clearTimeout, setTimeout } from "timers";
|
||||||
import b4a from "b4a";
|
import b4a from "b4a";
|
||||||
import {
|
import {
|
||||||
|
hashQuery,
|
||||||
isPromise,
|
isPromise,
|
||||||
validateResponse,
|
validateResponse,
|
||||||
validateTimestampedResponse,
|
validateTimestampedResponse,
|
||||||
|
@ -51,6 +52,19 @@ export default class SimpleRpcQuery extends RpcQueryBase {
|
||||||
|
|
||||||
const rpc = new RPC(socket);
|
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 {
|
try {
|
||||||
await this.queryRpc(rpc, this._query);
|
await this.queryRpc(rpc, this._query);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|
Loading…
Reference in New Issue