import username search

This commit is contained in:
hzrd149 2024-02-16 14:23:14 +00:00
parent 21c9400c94
commit 5e21375a1b
2 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import { createRoot } from "react-dom/client";
import { App } from "./app";
import { GlobalProviders } from "./providers/global";
import "./services/user-event-sync";
import "./services/username-search";
// setup bitcoin connect
import { init, onConnected } from "@getalby/bitcoin-connect-react";

View File

@ -3,13 +3,16 @@ import { getSearchNames } from "../helpers/nostr/user-metadata";
import db from "./db";
import replaceableEventsService from "./replaceable-events";
import userMetadataService from "./user-metadata";
import { logger } from "../helpers/debug";
const WRITE_USER_SEARCH_BATCH_TIME = 500;
const log = logger.extend("UsernameSearch");
const writeSearchQueue = new Set<string>();
const writeSearchData = _throttle(async () => {
if (writeSearchQueue.size === 0) return;
log(`Writing ${writeSearchQueue.size} to search table`);
const keys = Array.from(writeSearchQueue);
writeSearchQueue.clear();