LRUCache ParsedZaps, import from system dir in worker
This commit is contained in:
2
packages/system/src/cache/events.ts
vendored
2
packages/system/src/cache/events.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { NostrEvent } from "nostr";
|
||||
import { NostrEvent } from "../nostr";
|
||||
import { DexieTableLike, FeedCache } from "@snort/shared";
|
||||
|
||||
export class EventsCache extends FeedCache<NostrEvent> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ReqFilter } from "nostr";
|
||||
import { ReqFilter } from "./nostr";
|
||||
|
||||
/**
|
||||
* Remove empty filters, filters which would result in no results
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
Reference in New Issue
Block a user