logging
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Martti Malmi 2024-01-18 16:40:01 +02:00
parent d019544053
commit e3f8d48ddb
2 changed files with 5 additions and 3 deletions

View File

@ -36,7 +36,6 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
const [latest, setLatest] = useHistoryState(unixNow(), "TimelineFollowsLatest");
const [limit, setLimit] = useState(50);
const feed = useFollowsTimelineView(limit);
console.log("feed", feed);
const { muted, isEventMuted } = useModeration();
const oldest = useMemo(() => feed.at(-1)?.created_at, [feed]);

View File

@ -1,5 +1,6 @@
import { ID, ReqFilter as Filter, STR, TaggedNostrEvent, UID } from ".";
import loki from "lokijs";
import debug from "debug";
type PackedNostrEvent = {
id: UID;
@ -38,6 +39,8 @@ class InMemoryDB {
setTimeout(() => removeOldest(), 3000);
}
#log = debug("InMemoryDB");
get(id: string): TaggedNostrEvent | undefined {
const event = this.eventsCollection.by("id", ID(id)); // throw if db not ready yet?
if (event) {
@ -120,9 +123,9 @@ class InMemoryDB {
removeOldest(): void {
const count = this.eventsCollection.count();
console.log("InMemoryDB: count", count, this.maxSize);
this.#log("InMemoryDB: count", count, this.maxSize);
if (count > this.maxSize) {
console.log("InMemoryDB: removing oldest events", count - this.maxSize);
this.#log("InMemoryDB: removing oldest events", count - this.maxSize);
this.eventsCollection
.chain()
.simplesort("saved_at")