While using the young card limit of 375.0 with a deck that had 361 young cards and 20 new cards per day, I noticed the plugin wasn't throttling gradually. Figuring it may only throttling after the limit is passed, I tried 360.0 and noticed it immediately went to 0. Trying to get gradual behavior I did some digging around the plugin.
It turns out, since the config value was a float, the computed new_limit came out to 14.0. The problem is that when persisting this new limit with deck["newLimitToday"] = { "limit": new_limit, ... }, Anki silently ignores floating-point values of the limit, so this ends up being equivalent to no limit being applied.
This commit rounds the limit to an integer before storage, to ensure it's persisted regardless of any other floating-point weirdness. As a workaround, one should ensure their config only uses integer limits, at least for the young and soon limits since the load limit is math.ceiled before storage.
While using the young card limit of
375.0
with a deck that had 361 young cards and 20 new cards per day, I noticed the plugin wasn't throttling gradually. Figuring it may only throttling after the limit is passed, I tried360.0
and noticed it immediately went to 0. Trying to get gradual behavior I did some digging around the plugin.It turns out, since the config value was a float, the computed
new_limit
came out to14.0
. The problem is that when persisting this new limit withdeck["newLimitToday"] = { "limit": new_limit, ... }
, Anki silently ignores floating-point values of the limit, so this ends up being equivalent to no limit being applied.This commit rounds the limit to an integer before storage, to ensure it's persisted regardless of any other floating-point weirdness. As a workaround, one should ensure their config only uses integer limits, at least for the young and soon limits since the load limit is
math.ceil
ed before storage.