debug: streaming, simplify other logs
This commit is contained in:
parent
4e01e8e626
commit
7b9baef165
|
@ -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),
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue