logging
This commit is contained in:
parent
d019544053
commit
e3f8d48ddb
@ -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]);
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user