make redis optional for backend
This commit is contained in:
@ -31,18 +31,6 @@ services:
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
redis:
|
||||
image: "redis:6.0.9-alpine"
|
||||
container_name: "omnivore-redis"
|
||||
ports:
|
||||
- "6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 15s
|
||||
timeout: 90s
|
||||
expose:
|
||||
- 6379
|
||||
|
||||
api:
|
||||
build:
|
||||
|
||||
@ -158,7 +158,10 @@ const main = async (): Promise<void> => {
|
||||
// as healthy.
|
||||
await appDataSource.initialize()
|
||||
|
||||
await redisClient.connect()
|
||||
// redis is optional
|
||||
if (env.redis.url) {
|
||||
await redisClient.connect()
|
||||
}
|
||||
|
||||
const { app, apollo, httpServer } = createApp()
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import { EntityLabel } from '../entity/entity_label'
|
||||
import { Highlight } from '../entity/highlight'
|
||||
import { Label } from '../entity/label'
|
||||
import { LibraryItem, LibraryItemState } from '../entity/library_item'
|
||||
import { env } from '../env'
|
||||
import { BulkActionType, InputMaybe, SortParams } from '../generated/graphql'
|
||||
import { createPubSubClient, EntityType } from '../pubsub'
|
||||
import {
|
||||
@ -818,7 +819,10 @@ export const createLibraryItem = async (
|
||||
userId
|
||||
)
|
||||
|
||||
await setRecentlySavedItemInRedis(userId, newLibraryItem.originalUrl)
|
||||
// set recently saved item in redis if redis is enabled
|
||||
if (env.redis.url) {
|
||||
await setRecentlySavedItemInRedis(userId, newLibraryItem.originalUrl)
|
||||
}
|
||||
|
||||
if (skipPubSub) {
|
||||
return newLibraryItem
|
||||
|
||||
Reference in New Issue
Block a user