Currently, the batch kudos notification code calls the Redis KEYS command once for each author who received kudos in the past day:
However, the Redis docs discourage the use of KEYS in production code:
Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout. Don't use KEYS in your regular application code.
The batch kudos notification code should be rewritten to avoid the use of KEYS.
The deploy for this may be a bit tricky. Ideally, all users should be notified about all kudos they receive, even those that were recorded by the old kudos notification code right before the new kudos notification code goes live. There are several different possible approaches to take, including the following:
Deploy the new code, then run rake notifications:deliver_kudos one last time on an old copy of the code (like ). This would result in an extra kudos email.
Split this issue over two deploys: one to add extra sets for bookkeeping purposes (that aren't immediately used, because the data added just before the deploy wouldn't be tracked properly), and one to get rid of the call to KEYS (deployed at least a day later).
Write an After task, to be run immediately after deploy, to make sure that all of the information added prior to the deploy is updated to match the new code.
The instructions for how to test the change from the old kudos notification code to the new kudos notification code will depend on the approach taken. However, the instructions for testing the new code should be the same in all cases:
Find (or create) a work by an account whose email you have access to.
Leave a logged-in kudos on the work.
Leave a logged-out kudos on the work.
Wait until the kudos notification emails are sent.
Make sure that the email includes both of the kudos that you left.