mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-08-09 09:43:05 +02:00
import username search
This commit is contained in:
@@ -3,6 +3,7 @@ import { createRoot } from "react-dom/client";
|
|||||||
import { App } from "./app";
|
import { App } from "./app";
|
||||||
import { GlobalProviders } from "./providers/global";
|
import { GlobalProviders } from "./providers/global";
|
||||||
import "./services/user-event-sync";
|
import "./services/user-event-sync";
|
||||||
|
import "./services/username-search";
|
||||||
|
|
||||||
// setup bitcoin connect
|
// setup bitcoin connect
|
||||||
import { init, onConnected } from "@getalby/bitcoin-connect-react";
|
import { init, onConnected } from "@getalby/bitcoin-connect-react";
|
||||||
|
@@ -3,13 +3,16 @@ import { getSearchNames } from "../helpers/nostr/user-metadata";
|
|||||||
import db from "./db";
|
import db from "./db";
|
||||||
import replaceableEventsService from "./replaceable-events";
|
import replaceableEventsService from "./replaceable-events";
|
||||||
import userMetadataService from "./user-metadata";
|
import userMetadataService from "./user-metadata";
|
||||||
|
import { logger } from "../helpers/debug";
|
||||||
|
|
||||||
const WRITE_USER_SEARCH_BATCH_TIME = 500;
|
const WRITE_USER_SEARCH_BATCH_TIME = 500;
|
||||||
|
const log = logger.extend("UsernameSearch");
|
||||||
|
|
||||||
const writeSearchQueue = new Set<string>();
|
const writeSearchQueue = new Set<string>();
|
||||||
const writeSearchData = _throttle(async () => {
|
const writeSearchData = _throttle(async () => {
|
||||||
if (writeSearchQueue.size === 0) return;
|
if (writeSearchQueue.size === 0) return;
|
||||||
|
|
||||||
|
log(`Writing ${writeSearchQueue.size} to search table`);
|
||||||
const keys = Array.from(writeSearchQueue);
|
const keys = Array.from(writeSearchQueue);
|
||||||
writeSearchQueue.clear();
|
writeSearchQueue.clear();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user