this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix? shutdown

alice 2aeb93c2 eca8c20e

+7 -8
+7 -8
src/main.ts
··· 34 34 jetstream.on('open', () => { 35 35 logger.info(`Connected to Jetstream at ${FIREHOSE_URL}`); 36 36 cursorUpdateInterval = setInterval(() => { 37 - logger.info(`Cursor updated to: ${cursor} (${new Date(cursor / 1000).toISOString()})`); 38 - fs.writeFile('cursor.txt', cursor.toString(), (err) => { 39 - if (err) logger.error(err); 40 - }); 37 + if (jetstream.cursor) { 38 + logger.info(`Cursor updated to: ${jetstream.cursor} (${new Date(jetstream.cursor / 1000).toISOString()})`); 39 + fs.writeFile('cursor.txt', cursor.toString(), (err) => { 40 + if (err) logger.error(err); 41 + }); 42 + } 41 43 }, CURSOR_UPDATE_INTERVAL); 42 44 }); 43 45 ··· 51 53 }); 52 54 53 55 jetstream.onCreate(WANTED_COLLECTION, (event: CommitCreateEvent<typeof WANTED_COLLECTION>) => { 54 - cursor = event.time_us; 55 56 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition 56 57 if (event.commit?.record?.subject?.uri?.includes(DID)) { 57 58 label(event.did, event.commit.record.subject.uri.split('/').pop()!).catch((error: unknown) => { 58 - logger.error(`Unexpected error labeling ${event.did}:`); 59 - logger.error(error); 59 + logger.error(`Unexpected error labeling ${event.did}: ${error}`); 60 60 }); 61 61 } 62 62 }); ··· 85 85 metricsServer.close(); 86 86 clearInterval(cursorUpdateInterval); 87 87 fs.writeFileSync('cursor.txt', cursor.toString(), 'utf8'); 88 - process.exit(0); 89 88 } 90 89 91 90 process.on('SIGINT', shutdown);