INNER CODE UNIT · TypeScript

fillTCGPlayerCache

tcgdex/cards-database · server/src/libs/providers/tcgplayer/index.ts:13

export function fillTCGPlayerCache(data: typeof cache) {
	lastFetch = new Date()
	cache = data
}

export async function updateTCGPlayerDatas(): Promise<boolean> {
	// disable queries on secondary elements
	if (!cluster.isPrimary) {
		return true
	}

	// only fetch at max, once an hour
	if (lastFetch && lastFetch.getTime() > new Date().getTime() - 3600000) {
		return false
	}

	const products = sets.en
		.filter((it) => it?.thirdParty?.tcgplayer)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…