<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,6 @@ class &lt;%= migration_name %&gt; &lt; ActiveRecord::Migration
     create_table :&lt;%= table_name %&gt; do |t|
       t.string :queue_name
       t.text :data
-      t.string :token, :default =&gt; nil
       t.boolean :processed, :default =&gt; false, :null =&gt; false
 &lt;% unless options[:skip_timestamps] %&gt;
       t.timestamps
@@ -16,4 +15,4 @@ class &lt;%= migration_name %&gt; &lt; ActiveRecord::Migration
   def self.down
     drop_table :&lt;%= table_name %&gt;
   end
-end
\ No newline at end of file
+end</diff>
      <filename>generators/rude_q/templates/rude_q_migration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,4 @@
 # RudeQ
-require 'digest/sha1'
 
 # simply doing;
 #   class RudeQueue &lt; ActiveRecord::Base
@@ -86,9 +85,20 @@ module RudeQ
     end
 
     # A snapshot count of unprocessed items for the given +queue_name+
-    def backlog(queue_name)
-      qname = sanitize_queue_name(queue_name)
-      self.count(:conditions =&gt; {:queue_name =&gt; qname, :processed =&gt; false})
+    #
+    #   &gt;&gt; RudeQueue.backlog
+    #   -&gt; 265
+    #   &gt;&gt; RudeQueue.backlog(:one_queue)
+    #   -&gt; 212
+    #   &gt;&gt; RudeQueue.backlog(:another_queue)
+    #   -&gt; 53
+    #
+    def backlog(queue_name=nil)
+      conditions = {:processed =&gt; false}
+      if queue_name
+        conditions[:queue_name] = sanitize_queue_name(queue_name)
+      end
+      self.count(:conditions =&gt; conditions)
     end
     
     def fetch_with_lock(qname, &amp;block) # :nodoc:
@@ -161,9 +171,12 @@ module RudeQ
   # which misses the point
   #
   # also, it doesn't work on SQLite as it requires &quot;UPDATE ... LIMIT 1 ORDER id ASC&quot;
+  # and as of RudeQueue2, you'll need to manually add the &quot;token&quot; column
   module TokenLock
     class &lt;&lt; self
       
+      require 'digest/sha1'
+      
       def fetch_with_lock(klass, qname) # :nodoc:
         token = get_unique_token
         klass.update_all([&quot;token = ?&quot;, token], [&quot;queue_name = ? AND processed = ? AND token IS NULL&quot;, qname, false], :limit =&gt; 1, :order =&gt; &quot;id ASC&quot;)</diff>
      <filename>lib/rude_q.rb</filename>
    </modified>
    <modified>
      <diff>@@ -197,18 +197,24 @@ describe RudeQ::ClassMethods do # ProcessQueue extends ClassMethods
   
   describe &quot;.backlog&quot; do
     it &quot;should count the unprocessed items for the provided queue_name&quot; do
+      ProcessQueue.delete_all
+
       ProcessQueue.backlog(:abcde).should == 0
-      
+      ProcessQueue.backlog().should == 0
+
       ProcessQueue.set(:abcde, &quot;a value&quot;)
       ProcessQueue.backlog(:abcde).should == 1
-      
+      ProcessQueue.backlog().should == 1
+
       ProcessQueue.set(:something_else, &quot;another value&quot;)
       3.times { ProcessQueue.set(:abcde, :add_three_more)}
       
       ProcessQueue.backlog(:abcde).should == 4
-      
+      ProcessQueue.backlog().should == 5
+
       ProcessQueue.get(:abcde).should == &quot;a value&quot;
       ProcessQueue.backlog(:abcde).should == 3
+      ProcessQueue.backlog().should == 4
     end
   end
 </diff>
      <filename>spec/rude_q_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c338cd86880337d000df1387ae6eab00299cc916</id>
    </parent>
  </parents>
  <author>
    <name>Matthew Rudy Jacobs</name>
    <email>matthewrudyjacobs@gmail.com</email>
  </author>
  <url>http://github.com/matthewrudy/rudeq/commit/22baea8d1e95e5c0efe0fef1aa3c3382c3fafcda</url>
  <id>22baea8d1e95e5c0efe0fef1aa3c3382c3fafcda</id>
  <committed-date>2009-02-12T13:49:01-08:00</committed-date>
  <authored-date>2009-02-12T13:49:01-08:00</authored-date>
  <message>RudeQueue.backlog() counts all the unprocessed Queue items,
RudeQueue.backlog(:some_queue) scopes that count the particular Queue</message>
  <tree>6d518963c10db37366759c1d8934beb761e620b0</tree>
  <committer>
    <name>Matthew Rudy Jacobs</name>
    <email>matthewrudyjacobs@gmail.com</email>
  </committer>
</commit>
