Verified Commit feda5102 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Better handling of toots date

parent e2741625
Pipeline #4241 passed with stages
in 1 minute and 18 seconds
......@@ -98,14 +98,20 @@ export default {
// results.progress = 0
// results.progressCount
results.accounts = {}
let cont = true
while (cont) {
let tooOld = 0
let maxOld = 5
while (tooOld < maxOld) {
let response = await client.get(url, {params: {limit: 40}})
response.data.forEach((f) => {
let date = moment(f.created_at)
// ugly hack because we don't have any way to query favorite date, and mastodon
// return toots in reverse favorite date order, so favoriting a very old toot
// can result in little to no suggestions
if (date.isBefore(dateLimit)) {
cont = false
return
tooOld += 1
} else {
// we reset the counter
tooOld = 0
}
handledFavorites += 1
results.progressCount += 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment