debug: streaming, simplify other logs

This commit is contained in:
Alex Gleason 2023-12-27 20:39:38 -06:00
parent 4e01e8e626
commit 7b9baef165
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 6 additions and 3 deletions

View File

@ -1,11 +1,13 @@
import { type AppController } from '@/app.ts';
import { z } from '@/deps.ts';
import { Debug, z } from '@/deps.ts';
import { type DittoFilter } from '@/filter.ts';
import { getAuthor, getFeedPubkeys } from '@/queries.ts';
import { Sub } from '@/subs.ts';
import { bech32ToPubkey } from '@/utils.ts';
import { renderStatus } from '@/views/mastodon/statuses.ts';
const debug = Debug('ditto:streaming');
/**
* Streaming timelines/categories.
* https://docs.joinmastodon.org/methods/streaming/#streams
@ -49,6 +51,7 @@ const streamingController: AppController = (c) => {
function send(name: string, payload: object) {
if (socket.readyState === WebSocket.OPEN) {
debug('send', name, JSON.stringify(payload));
socket.send(JSON.stringify({
event: name,
payload: JSON.stringify(payload),

View File

@ -23,7 +23,7 @@ class SubscriptionStore {
* ```
*/
sub<K extends number>(socket: unknown, id: string, filters: DittoFilter<K>[]): Subscription<K> {
debug('sub', id, filters);
debug('sub', id, JSON.stringify(filters));
let subs = this.#store.get(socket);
if (!subs) {

View File

@ -48,7 +48,7 @@ function lookupNip05Cached(value: string): Promise<string | null> {
const cached = nip05Cache.get(value);
if (cached !== undefined) return cached;
debug(`Looking up NIP-05 for ${value}`);
debug(`Lookup ${value}`);
const result = lookup(value);
nip05Cache.set(value, result);