added waiting time to fit 100.000 rate limit

This commit is contained in:
Nicolas Constant 2021-09-05 01:03:01 -04:00
parent 2a4136cc8d
commit 66e1e84da2
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 6 additions and 1 deletions

View File

@ -55,7 +55,12 @@ namespace BirdsiteLive.Pipeline.Processors
}
var splitCount = splitUsers.Count();
if (splitCount < 15) await Task.Delay((15 - splitCount) * WaitFactor, ct);
if (splitCount < 15) await Task.Delay((15 - splitCount) * WaitFactor, ct); //Always wait 15min
// Extra wait time to fit 100.000/day limit
var extraWaitTime = (int)Math.Ceiling((60 / ((100000d / 24) / userCount)) - 15);
if (extraWaitTime < 0) extraWaitTime = 0;
await Task.Delay(extraWaitTime * 1000, ct);
}
catch (Exception e)
{