Compare commits

...

2 Commits

Author SHA1 Message Date
Kevin Dang
a2c954136d Fix: redis workaround for local non docker 2025-05-08 22:02:26 -07:00
Kevin Dang
5820583609 Update: simplify npm command to run tests 2025-05-08 21:16:32 -07:00
4 changed files with 13 additions and 10 deletions

View File

@@ -36,7 +36,7 @@ jobs:
- name: Collect Code Coverage
run: |
LINE_PCT=$(npm run test:coverage | tail -2 | head -1 | awk '{print $3}')
LINE_PCT=$(npm run coverage | tail -2 | head -1 | awk '{print $3}')
echo "COVERAGE=$LINE_PCT" >> $GITHUB_ENV
- name: Upload Code Coverage

View File

@@ -47,4 +47,4 @@ jobs:
- name: Test Application
run: |
npm run test:run
npm run tests

View File

@@ -5,8 +5,8 @@
"main": "build/index.js",
"exports": "./build/index.js",
"scripts": {
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
"tests": "vitest run",
"coverage": "vitest run --coverage",
"watch": "tsx watch src",
"build": "tsc",
"prod": "node .",

View File

@@ -33,12 +33,15 @@ const messageHistory: Queue<UserMessage> = new Queue<UserMessage>
registerEvents(client, Events, messageHistory, ollama, Keys.defaultModel)
// Try to connect to redis
try {
await redis.connect()
.then(() => console.log('[Redis] Connected'))
.catch((error) => {
console.error('[Redis] Connection Error', error)
process.exit(1)
})
console.log('[Redis] Successfully Connected')
} catch(error) {
console.error('[Redis] Connection Error. See error below:\n', error)
console.warn('[Redis] Failed to connect to Redis Database, using local system')
// TODO: create boolean flag that will probably be used in messageCreate.ts if redis database is down
// When implementing this boolean flag, move connection to database BEFORE the registerEvents method
}
// Try to log in the client
await client.login(Keys.clientToken)