Discussions

Ask a Question
Back to All

Update recipe for stale/old link

The recipe given to delete links older than a certain amount of time is not optimized as by default it retrieves all links ordered by creation time descending.

Which means we start by iterating over link that are valid for nothing.

Wouldn't it be wiser to set the corresponding code
querystring = urlencode({
"limit": MAX_PAGE_SIZE,
"last": lastLink["id"] if lastLink else "",
"orderBy": "createdAt",
"orderDir": "desc"
})

to

querystring = urlencode({
"limit": MAX_PAGE_SIZE,
"last": lastLink["id"] if lastLink else "",
"orderBy": "createdAt",
"orderDir": "asc"
})