Skip to content

Commit

Permalink
Revert "Adds debugging to tags list"
Browse files Browse the repository at this point in the history
This reverts commit 3c393d2.
  • Loading branch information
davidmerfield committed Feb 12, 2025
1 parent e3cb40c commit 14dd8e7
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions app/models/tags/list.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
const client = require("models/client");
const ensure = require("helper/ensure");
const key = require("./key");
const clfdate = require("helper/clfdate");

module.exports = async function getAll(blogID, callback) {
try {
ensure(blogID, "string").and(callback, "function");

console.log(clfdate(), "Fetching all tags for", blogID);

// Fetch all tags using SMEMBERS
const allTags = await new Promise((resolve, reject) => {
client.smembers(key.all(blogID), (err, result) => {
Expand All @@ -17,16 +14,13 @@ module.exports = async function getAll(blogID, callback) {
});
});

console.log(clfdate(), "Found", allTags.length, "tags for", blogID);

if (allTags.length === 0) {
return callback(null, []); // No tags to process
}

// Iterate over tags and fetch their details
const tags = [];
for (const tag of allTags) {
console.log(clfdate(), "Fetching tag", tag, "for", blogID);
const [entries, name] = await Promise.all([
new Promise((resolve, reject) => {
client.smembers(key.tag(blogID, tag), (err, result) => {
Expand All @@ -42,7 +36,6 @@ module.exports = async function getAll(blogID, callback) {
}),
]);

console.log(clfdate(), "Fetched", entries.length, "entries for tag", tag, "for", blogID);
if (entries.length > 0) {
tags.push({
name,
Expand All @@ -52,7 +45,6 @@ module.exports = async function getAll(blogID, callback) {
}
}

console.log(clfdate(), "Fetched all tags for", blogID);
return callback(null, tags);
} catch (error) {
return callback(error);
Expand Down

0 comments on commit 14dd8e7

Please sign in to comment.