mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
fix cache keys
This commit is contained in:
@@ -28,7 +28,7 @@ builder.defineCatalogHandler((args) => {
|
|||||||
return Promise.reject(`No catalog found for with id: ${args.id}`)
|
return Promise.reject(`No catalog found for with id: ${args.id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const cacheKey = `${args.id}|${genre}|${offset}`
|
const cacheKey = `${args.id}|${genre}|${dateKey()}|${offset}`
|
||||||
return limiter.schedule(() => cacheWrapCatalog(cacheKey, () => getCatalog(catalog, genre, offset)))
|
return limiter.schedule(() => cacheWrapCatalog(cacheKey, () => getCatalog(catalog, genre, offset)))
|
||||||
.then(metas => ({
|
.then(metas => ({
|
||||||
metas: metas,
|
metas: metas,
|
||||||
@@ -53,7 +53,7 @@ async function getCatalog(catalog, genre, offset) {
|
|||||||
const cursor = await getCursor(catalog, genre, offset)
|
const cursor = await getCursor(catalog, genre, offset)
|
||||||
const startDate = getStartDate(genre)?.toISOString();
|
const startDate = getStartDate(genre)?.toISOString();
|
||||||
const endDate = getEndDate(genre)?.toISOString();
|
const endDate = getEndDate(genre)?.toISOString();
|
||||||
const cacheKey = `${catalog.id}|${genre}||${dateKey()}`
|
const cacheKey = `${catalog.id}|${genre}|${dateKey()}`
|
||||||
|
|
||||||
return cacheWrapIds(cacheKey, () => repository.getIds(catalog.type, startDate, endDate))
|
return cacheWrapIds(cacheKey, () => repository.getIds(catalog.type, startDate, endDate))
|
||||||
.then(ids => ids.slice(ids.indexOf(cursor) + 1))
|
.then(ids => ids.slice(ids.indexOf(cursor) + 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user