diff --git a/app/lib/cache.server.ts b/app/lib/cache.server.ts index 9bd9a61..875137d 100644 --- a/app/lib/cache.server.ts +++ b/app/lib/cache.server.ts @@ -15,7 +15,7 @@ export async function getCachedFiles(repo: string, branch: string) { export async function deleteAllCaches(repo: string) { return withRedis(async (db) => { const cacheKeys = await db.smembers(`caches:${repo}`) - await db.del(cacheKeys) + return await db.del(`caches:${repo}`, ...cacheKeys) }) } diff --git a/app/lib/projects.server.ts b/app/lib/projects.server.ts index 012339d..145ae18 100644 --- a/app/lib/projects.server.ts +++ b/app/lib/projects.server.ts @@ -317,7 +317,8 @@ export async function deleteDraft(project: Project, path: string) { export async function deleteAllDrafts(project: Project) { return withRedis(async (db) => { const draftKeys = await db.smembers(`drafts:${project.repo}`) - await db.del(draftKeys) + console.log(draftKeys) + return await db.del(`drafts:${project.repo}`, ...draftKeys) }) } diff --git a/app/routes/p/$project/settings.tsx b/app/routes/p/$project/settings.tsx index aef583f..59f3791 100644 --- a/app/routes/p/$project/settings.tsx +++ b/app/routes/p/$project/settings.tsx @@ -68,13 +68,13 @@ export const action: ActionFunction = async ({ request, params }) => { } if (op === 'clearCache') { - await deleteAllCaches(project.repo) - flashMessage = 'Cache cleared successfully' + const num = await deleteAllCaches(project.repo) + flashMessage = `Cache cleared successfully. Cleared ${num} files.` } if (op === 'removeDrafts') { - await deleteAllDrafts(project) - flashMessage = 'Drafts removed successfully' + const num = await deleteAllDrafts(project) + flashMessage = `Drafts removed successfully. Removed ${num} drafts.` } const headers = new Headers({