LRUCache ParsedZaps, import from system dir in worker

This commit is contained in:
Martti Malmi
2024-02-05 11:20:13 +02:00
parent a97e895cb8
commit aefe8a8210
5 changed files with 16 additions and 10 deletions

View File

@ -1,4 +1,4 @@
import { NostrEvent } from "nostr";
import { NostrEvent } from "../nostr";
import { DexieTableLike, FeedCache } from "@snort/shared";
export class EventsCache extends FeedCache<NostrEvent> {

View File

@ -1,4 +1,4 @@
import { ReqFilter } from "nostr";
import { ReqFilter } from "./nostr";
/**
* Remove empty filters, filters which would result in no results

View File

@ -24,8 +24,8 @@ import { CachedTable } from "@snort/shared";
import { EventsCache } from "../cache/events";
import { RelayMetricHandler } from "../relay-metric-handler";
import debug from "debug";
import { ConnectionPool } from "connection-pool";
import { CacheRelay } from "cache-relay";
import { ConnectionPool } from "../connection-pool";
import { CacheRelay } from "../cache-relay";
export class SystemWorker extends EventEmitter<NostrSystemEvents> implements SystemInterface {
#log = debug("SystemWorker");

View File

@ -4,9 +4,10 @@ import { findTag } from "./utils";
import { EventExt } from "./event-ext";
import { NostrLink } from "./nostr-link";
import debug from "debug";
import {LRUCache} from "lru-cache";
const Log = debug("zaps");
const ParsedZapCache = new Map<string, ParsedZap>();
const ParsedZapCache = new LRUCache<string, ParsedZap>({ max: 1000 });
function getInvoice(zap: NostrEvent): InvoiceDetails | undefined {
const bolt11 = findTag(zap, "bolt11");