Skip to content

Commit

Permalink
fix: check for stale cache first
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Apr 2, 2024
1 parent 598905f commit e05eae8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ router.post('/ai/summary/:id', async (req, res) => {
const aiSummary = new AiSummary(id, storageEngine(process.env.AI_SUMMARY_SUBDIR));

try {
const cachedSummary = await aiSummary.getCache();
const cachedSummary = (await aiSummary.isCacheable()) && (await aiSummary.getCache());

let summary = '';

Expand All @@ -66,7 +66,7 @@ router.post('/ai/tts/:id', async (req, res) => {
const aiTextTpSpeech = new AiTextToSpeech(id, storageEngine(process.env.AI_TTS_SUBDIR));

try {
const cachedAudio = await aiTextTpSpeech.getCache();
const cachedAudio = (await aiTextTpSpeech.isCacheable()) && (await aiTextTpSpeech.getCache());

let audio: Buffer;

Expand Down

0 comments on commit e05eae8

Please sign in to comment.