Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ function openUrl(url) {
}

// Load resources from local file or fetch remotely using shared loader
async function loadData() {
return loadCatalog();
async function loadData(options = {}) {
const cliArgs = process.argv.slice(2);
const shouldRefresh = cliArgs.includes("--refresh") || cliArgs.includes("-r");
return loadCatalog({ ...options, refresh: options.refresh || shouldRefresh });
}

async function loadMatchmakerData() {
Expand Down
4 changes: 2 additions & 2 deletions bin/lib/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const __dirname = path.dirname(__filename);

let cachedCatalog = null;

export const DEFAULT_CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
export const DEFAULT_CACHE_TTL_MS = 4 * 60 * 60 * 1000; // 4 hours auto-refresh TTL

export function getMilestone(totalCount) {
const count = Number(totalCount);
Expand Down Expand Up @@ -109,8 +109,8 @@ export function clearPersistentCache() {
*/
export async function fetchLiveCatalog(timeoutMs = 4000, fetchFn = fetch) {
const candidateUrls = [
"https://ritualdev.in/data.json",
"https://raw.githubusercontent.com/RitualDev-Lab/DevShelf/main/site/data.json",
"https://ritualdev.in/data.json",
"https://devshelf.ritualdev.in/data.json",
];

Expand Down
Loading