forked from Kieran/snort
on init, load cached profiles to fuzzy search
This commit is contained in:
parent
45245153ab
commit
6026ed34a8
@ -42,7 +42,6 @@ export const addEventToFuzzySearch = ev => {
|
||||
};
|
||||
|
||||
export const addCachedMetadataToFuzzySearch = (profile: CachedMetadata) => {
|
||||
// TODO add profiles from Cache
|
||||
requestAnimationFrame(() => {
|
||||
const existing = profileTimestamps.get(profile.pubkey);
|
||||
if (existing) {
|
||||
|
@ -39,6 +39,12 @@ if (CONFIG.httpCache) {
|
||||
};
|
||||
}
|
||||
|
||||
System.ProfileLoader.Cache.hook(() => {
|
||||
System.ProfileLoader.Cache.takeSnapshot().forEach(a => {
|
||||
console.log("Profile: %O", a);
|
||||
});
|
||||
}, "profiles");
|
||||
|
||||
export async function fetchProfile(key: string) {
|
||||
try {
|
||||
throwIfOffline();
|
||||
|
2
packages/system/src/cache/user-metadata.ts
vendored
2
packages/system/src/cache/user-metadata.ts
vendored
@ -1,5 +1,6 @@
|
||||
import { CachedMetadata } from ".";
|
||||
import { fetchNip05Pubkey, FeedCache, LNURL, DexieTableLike } from "@snort/shared";
|
||||
import { addCachedMetadataToFuzzySearch } from "@snort/app/src/Db/FuzzySearch";
|
||||
|
||||
export class UserProfileCache extends FeedCache<CachedMetadata> {
|
||||
#zapperQueue: Array<{ pubkey: string; lnurl: string }> = [];
|
||||
@ -21,6 +22,7 @@ export class UserProfileCache extends FeedCache<CachedMetadata> {
|
||||
if (follows) {
|
||||
await this.buffer(follows);
|
||||
}
|
||||
this.snapshot().forEach(p => addCachedMetadataToFuzzySearch(p));
|
||||
}
|
||||
|
||||
async search(q: string): Promise<Array<CachedMetadata>> {
|
||||
|
Loading…
Reference in New Issue
Block a user