guard against memory bloat

instead of processing all notifications, we fetch all ids and then process
them in batches of 1000