Instead of querying the database one package at a time I am now querying all packages and just update those who have a visits count.
Example call: rake debshots:accesslog2visits['cache-access-example.log']