Skip to content

Commit

Permalink
refactor: use helper function to instantiate keyv
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Besson committed Nov 21, 2024
1 parent 564447a commit 96fe880
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/garmin/garmin.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import KeyvRedis from '@keyv/redis';
import { createKeyv } from '@keyv/redis';
// eslint-disable-next-line import/no-named-as-default
import Keyv, { KeyvStoreAdapter } from 'keyv';
import Keyv from 'keyv';
import type { Context } from 'koa';

import config from '../../config';
Expand All @@ -14,7 +14,7 @@ class GarminController {
constructor() {
const connectionUri = config.get('keyv.connectionUri');
this.keyv = connectionUri
? new Keyv(new KeyvRedis(connectionUri, { namespace: 'tracking' }) as KeyvStoreAdapter)
? createKeyv(connectionUri, { namespace: 'tracking' })
: new Keyv({ namespace: 'tracking' });
this.keyv.on('error', () => {
throw new Error('Unable to connect to Redis instance with URI ' + connectionUri);
Expand Down

0 comments on commit 96fe880

Please sign in to comment.