Very early code, so not perfect. Might do some refactoring and change how it works to not miss anything after a downtime (as long as it doesn't last the 40 hours

).
I'd say you should start from the last processed Merit, without a time limit. Even if you don't notify the user anymore because it's been too long (for a new user, or after downtime), it should still be added to the total Merit count.
I could get you
a weekly total, but you'll need to still account for Merits that were sent after theymos' cut-off for his weekly
merit.txt.xz dump.