Browse files

README updates, and setting 'priority' in the 'right' direction.

  • Loading branch information...
1 parent 3a2d17a commit 41a2069d50708b5d901a660c5b0038d47750f85f Dan Lecocq committed May 18, 2012
Showing with 12 additions and 13 deletions.
  1. +1 −1 Gemfile
  2. +1 −1 LICENSE
  3. +5 −6 README.md
  4. +1 −1 lib/qless/qless-core
  5. +4 −4 spec/integration/qless_spec.rb
View
2 Gemfile
@@ -1,7 +1,7 @@
source "http://rubygems.org"
# Specify your gem's dependencies in qless.gemspec
-gemspec :name => 'qless.gemspec'
+gemspec
group :development do
gem 'debugger', :platform => :mri
View
2 LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2011 SEOmoz
+Copyright (c) 2012 SEOmoz
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
11 README.md
@@ -29,7 +29,6 @@ otherwise, that worker should just drop it and let the system reclaim it.
Features
========
-1. __Client Managed__ -- Just run a Redis 2.6 instance, point your workers at it.
1. __Jobs don't get dropped on the floor__ -- Sometimes workers drop jobs. Qless
automatically picks them back up and gives them to another worker
1. __Tagging / Tracking__ -- Some jobs are more interesting than others. Track those
@@ -42,7 +41,7 @@ Features
1. __Job data is stored temporarily__ -- Job info sticks around for a configurable
amount of time so you can still look back on a job's history, data, etc.
1. __Priority__ -- Jobs with the same priority get popped in the order they were
- inserted. Otherwise, it's like `nice`ness; lower number means popped sooner\
+ inserted; a higher priority means that it gets popped faster
1. __Retry logic__ -- Every job has a number of retries associated with it, which are
renewed when it is put into a new queue or completed. If a job is repeatedly
dropped, then it is presumed to be problematic, and is automatically failed.
@@ -240,16 +239,16 @@ Some jobs need to get popped sooner than others. Whether it's a trouble ticket,
debugging, you can do this pretty easily when you put a job in a queue:
``` ruby
-queue.put(MyJobClass, {:foo => 'bar'}, :priority => -10)
+queue.put(MyJobClass, {:foo => 'bar'}, :priority => 10)
```
What happens when you want to adjust a job's priority while it's still waiting in
a queue?
``` ruby
job = client.jobs['0c53b0404c56012f69fa482a1427ab7d']
-job.priority = -10
-# Now this will get popped before any job of lesser priority
+job.priority = 10
+# Now this will get popped before any job of lower priority
```
Scheduled Jobs
@@ -268,7 +267,7 @@ lesser-priority jobs:
``` ruby
# Run in 10 minutes
-queue.put(MyJobClass, {:foo => 'bar'}, :delay => 600, :priority => -100)
+queue.put(MyJobClass, {:foo => 'bar'}, :delay => 600, :priority => 100)
```
Recurring Jobs
2 lib/qless/qless-core
@@ -1 +1 @@
-Subproject commit ba743e16e9f39918173fea1c6dffb9b89a53118f
+Subproject commit c91b80687b35980d2789b25b76893c4676bcc6d9
View
8 spec/integration/qless_spec.rb
@@ -513,7 +513,7 @@ class FooJob
# sure that we get them in an order based on priority
# 1) Insert 10 jobs into the queue with successively more priority
# 2) Pop all the jobs, and ensure that with each pop we get the right one
- jids = 10.times.collect { |x| q.put(Qless::Job, {"test" => "put_pop_priority", "count" => x}, :priority => -x)}
+ jids = 10.times.collect { |x| q.put(Qless::Job, {"test" => "put_pop_priority", "count" => x}, :priority => x)}
last = jids.length
jids.length.times do |x|
job = q.pop
@@ -1580,10 +1580,10 @@ class FooJob
# 3) If a job's in a queue, but already popped, then we just update the
# job's priority.
it "can manipulate priority midstream" do
- a = q.put(Qless::Job, {"test" => "priority"}, :priority => -10)
+ a = q.put(Qless::Job, {"test" => "priority"}, :priority => 10)
b = q.put(Qless::Job, {"test" => "priority"})
q.peek.jid.should eq(a)
- client.jobs[b].priority = -20
+ client.jobs[b].priority = 20
q.length.should eq(2)
q.peek.jid.should eq(b)
job = q.pop
@@ -1592,7 +1592,7 @@ class FooJob
job = q.pop
q.length.should eq(2)
job.jid.should eq(a)
- job.priority = -30
+ job.priority = 30
# Make sure it didn't get doubly-inserted into the queue
q.length.should eq(2)
q.peek.should eq(nil)

0 comments on commit 41a2069

Please sign in to comment.