Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.

add redis connection and message logging

authored by nekomimi.pet and committed by

Tangled cffa87f0 f7471812

+25 -2
+6
apps/firehose-service/src/lib/cache-invalidation.ts
··· 24 24 } 25 25 26 26 if (!publisher) { 27 + console.log(`[CacheInvalidation] Connecting to Redis for publishing: ${config.redisUrl}`); 27 28 publisher = new Redis(config.redisUrl, { 28 29 maxRetriesPerRequest: 2, 29 30 enableReadyCheck: true, ··· 31 32 32 33 publisher.on('error', (err) => { 33 34 console.error('[CacheInvalidation] Redis error:', err); 35 + }); 36 + 37 + publisher.on('ready', () => { 38 + console.log('[CacheInvalidation] Redis publisher connected'); 34 39 }); 35 40 } 36 41 ··· 47 52 48 53 try { 49 54 const message = JSON.stringify({ did, rkey, action }); 55 + console.log(`[CacheInvalidation] Publishing ${action} for ${did}/${rkey} to ${CHANNEL}`); 50 56 await redis.publish(CHANNEL, message); 51 57 } catch (err) { 52 58 console.error('[CacheInvalidation] Failed to publish:', err);
+8 -2
apps/firehose-service/src/lib/revalidate-worker.ts
··· 38 38 return; 39 39 } 40 40 41 - console.log('[Revalidate] Processing', { did, rkey, reason, id }); 41 + console.log(`[Revalidate] Received message ${id}: ${did}/${rkey} (${reason})`); 42 42 43 43 const record = await fetchSiteRecord(did, rkey); 44 44 if (!record) { 45 - console.warn('[Revalidate] Site record not found', { did, rkey }); 45 + console.warn(`[Revalidate] Site record not found on PDS: ${did}/${rkey}`); 46 46 await redis.xack(config.revalidateStream, config.revalidateGroup, id); 47 47 return; 48 48 } 49 49 50 50 await handleSiteCreateOrUpdate(did, rkey, record.record, record.cid); 51 51 52 + console.log(`[Revalidate] Completed ${id}: ${did}/${rkey}`); 52 53 await redis.xack(config.revalidateStream, config.revalidateGroup, id); 53 54 } 54 55 ··· 155 156 156 157 if (running) return; 157 158 159 + console.log(`[Revalidate] Connecting to Redis: ${config.redisUrl}`); 158 160 redis = new Redis(config.redisUrl, { 159 161 maxRetriesPerRequest: 2, 160 162 enableReadyCheck: true, ··· 162 164 163 165 redis.on('error', (err) => { 164 166 console.error('[Revalidate] Redis error:', err); 167 + }); 168 + 169 + redis.on('ready', () => { 170 + console.log(`[Revalidate] Redis connected, stream: ${config.revalidateStream}, group: ${config.revalidateGroup}`); 165 171 }); 166 172 167 173 running = true;
+5
apps/hosting-service/src/lib/cache-invalidation.ts
··· 21 21 return; 22 22 } 23 23 24 + console.log(`[CacheInvalidation] Connecting to Redis for subscribing: ${redisUrl}`); 24 25 subscriber = new Redis(redisUrl, { 25 26 maxRetriesPerRequest: 2, 26 27 enableReadyCheck: true, ··· 28 29 29 30 subscriber.on('error', (err) => { 30 31 console.error('[CacheInvalidation] Redis error:', err); 32 + }); 33 + 34 + subscriber.on('ready', () => { 35 + console.log('[CacheInvalidation] Redis subscriber connected'); 31 36 }); 32 37 33 38 subscriber.subscribe(CHANNEL, (err) => {
+6
apps/hosting-service/src/lib/revalidate-queue.ts
··· 18 18 } 19 19 20 20 if (!client) { 21 + console.log(`[Revalidate] Connecting to Redis: ${redisUrl}`); 21 22 client = new Redis(redisUrl, { 22 23 maxRetriesPerRequest: 2, 23 24 enableReadyCheck: true, ··· 25 26 26 27 client.on('error', (err) => { 27 28 console.error('[Revalidate] Redis error:', err); 29 + }); 30 + 31 + client.on('ready', () => { 32 + console.log(`[Revalidate] Redis connected, stream: ${streamName}`); 28 33 }); 29 34 } 30 35 ··· 65 70 Date.now().toString() 66 71 ); 67 72 73 + console.log(`[Revalidate] Enqueued ${did}/${rkey} (${reason}) to ${streamName}`); 68 74 recordRevalidateResult('enqueued'); 69 75 return { enqueued: true, result: 'enqueued' }; 70 76 } catch (err) {