Remove old code, clean up redis logging

This commit is contained in:
Jackson Harper 2024-01-17 11:47:31 +08:00
parent 4f23271f29
commit d1438fe800
3 changed files with 8 additions and 43 deletions

View file

@ -96,6 +96,14 @@ const main = async () => {
console.log('completed job: ', job.jobId)
})
workerRedisClient.on('error', (error) => {
console.trace('[queue-processor]: redis worker error', { error })
})
redisClient.on('error', (error) => {
console.trace('[queue-processor]: redis error', { error })
})
const gracefulShutdown = async (signal: string) => {
console.log(`[queue-processor]: Received ${signal}, closing server...`)
server.close(async () => {

View file

@ -25,10 +25,6 @@ export class RedisDataSource {
this.workerRedisClient = createIORedisClient(this.options)
this.isInitialized = true
this.redisClient?.on('close', () => {
console.trace('closing redis client')
})
return this
}

View file

@ -36,45 +36,6 @@ export function rssFeedRouter() {
console.log('unable to fetchAll feeds, redis is not configured')
return res.status(500).send('Expired')
}
// // get active rss feed subscriptions scheduled for fetch and group by feed url
// const subscriptionGroups = (await getRepository(Subscription).query(
// `
// SELECT
// url,
// ARRAY_AGG(id) AS "subscriptionIds",
// ARRAY_AGG(user_id) AS "userIds",
// ARRAY_AGG(last_fetched_at) AS "fetchedDates",
// ARRAY_AGG(coalesce(scheduled_at, NOW())) AS "scheduledDates",
// ARRAY_AGG(last_fetched_checksum) AS checksums,
// ARRAY_AGG(fetch_content) AS "fetchContents",
// ARRAY_AGG(coalesce(folder, $3)) AS folders
// FROM
// omnivore.subscriptions
// WHERE
// type = $1
// AND status = $2
// AND (scheduled_at <= NOW() OR scheduled_at IS NULL)
// GROUP BY
// url
// `,
// [
// SubscriptionType.Rss,
// SubscriptionStatus.Active,
// DEFAULT_SUBSCRIPTION_FOLDER,
// ]
// )) as RssSubscriptionGroup[]
// // create a cloud taks to fetch rss feed item for each subscription
// await Promise.all(
// subscriptionGroups.map((subscriptionGroup) => {
// try {
// return enqueueRssFeedFetch(subscriptionGroup)
// } catch (error) {
// logger.info('error creating rss feed fetch task', error)
// }
// })
// )
} catch (error) {
logger.info('error fetching rss feeds', error)
return res.status(500).send('Internal Server Error')