README.markdown in resque-cleaner-0.2.2 vs README.markdown in resque-cleaner-0.2.3

- old
+ new

@@ -62,14 +62,22 @@ BadJob: 3 HorribleJob: 7 total: 10 => {'BadJob' => 3, ...} +Or you could also group them by exception. + + > cleaner.stats_by_exception + RuntimeError: 35 + SyntaxError: 7 + total: 42 + => {'RuntimeError' => 35, ...} + You can get the ones filtered with a block: it targets only jobs which the block -evaluetes true. +evaluates true. -e.g. Show stats only of jobs entried with some arguments: +e.g. Show stats only of jobs entered with some arguments: > cleaner.stats_by_date {|j| j["payload"]["args"].size > 0} 2009/03/13: 3 2009/11/13: 7 2010/08/13: 11 @@ -88,17 +96,17 @@ e.g. Retry only jobs with some arguments: > cleaner.requeue {|j| j["payload"]["args"].size > 0} The job hash is extended with a module which defines some useful methods. You -can use it in the blcok. +can use it in the block. -e.g. Retry only jobs entried within a day: +e.g. Retry only jobs entered within a day: > cleaner.requeue {|j| j.after?(1.day.ago)} -e.g. Retry EmailJob entried with arguments within 3 days: +e.g. Retry EmailJob entered with arguments within 3 days: > cleaner.requeue {|j| j.after?(3.days.ago) && j.klass?(EmailJob) && j["payload"]["args"].size>0} See Helper Methods section bellow for more information. @@ -110,20 +118,20 @@ You can clear all failed jobs with this method: > cleaner.clear -Like you can do with the retry method, the clear metod takes a block. Here are +Like you can do with the retry method, the clear method takes a block. Here are some examples: > cleaner.clear {|j| j.retried?} => clears all jobs already retried and returns number of the jobs. > cleaner.clear {|j| j.queue?(:low) && j.before?('2010-10-10')} => clears all jobs entried in :low queue before 10th October, 2010. - > cleaner.clear {|j| j["exception"]=="RuntimeError" && j.queue?(:low)} + > cleaner.clear {|j| j.exception?("RuntimeError") && j.queue?(:low)} => clears all jobs raised RuntimeError and queued :low queue **Retry and Clear Jobs** You can retry(requeue) and clear failed jobs at the same time; just pass true @@ -134,11 +142,11 @@ > cleaner.requeue(true) {|j| j.klass?(EmailJob)} **Retry with other queue** You can requeue failed jobs into other queue. In this way, you can retry failed -jobs without blocking jobs being entried by your service running in the live. +jobs without blocking jobs being entered by your service running in the live. e.g. Retry failed jobs on :retry queue > cleaner.requeue(false, :queue => :retry) @@ -148,24 +156,25 @@ **Select Jobs** You can just select the jobs of course. Here are some examples: - > cleaner.select {|j| j["exception"]=="RuntimeError"} + > cleaner.select {|j| j["payload"]["args"][0]=="Johonson"} > cleaner.select {|j| j.after?(2.days.ago)} > cleaner.select #=> returns all jobs **Helper Methods** -Here is a list of methods a failed job ratained through ResqueCleaner has: +Here is a list of methods a failed job retained through ResqueCleaner has: retried?: returns true if the job has already been retried. requeued?: alias of retried?. before?(time): returns true if the job failed before the time. after?(time): returns true if the job failed after the time. klass?(klass_or_name): returns true if the class of job matches. queue?(queue_name): returns true if the queue of job matches. + exception?(exception_name): returns true if the exception matches. Failed Job ----------- @@ -198,11 +207,11 @@ ResqueCleaner supposes recent jobs are more important than old jobs. Therefore ResqueCleaner deals with **ONLY LAST X(default=1000) JOBS**. In this way, you could avoid slow responses. You can change the number through `limiter` attribute. -Let's see how it works with an follwing example. +Let's see how it works with an following example. **Sample Situation** * Number of failed jobs: 100,000 @@ -225,24 +234,29 @@ > cleaner.limiter.count => 3,000 > cleaner.limiter.on? => true -With limiter, ResqueClener's filtering targets only the last X(3000 in this -sampe) failed jobs. +With limiter, ResqueCleaner's filtering targets only the last X(3000 in this +sample) failed jobs. > cleaner.select.size => 3,000 -The clear\_stale method deletes all jobs entried prior to the last X(3000 in +The clear\_stale method deletes all jobs entered prior to the last X(3000 in this sample) failed jobs. This calls Redis API and no iteration occurs on Ruby application; it should be quick even if there are huge number of failed jobs. > cleaner.clear_stale > cleaner.failure.count => 3,000 > cleaner.limiter.count => 3,000 > cleaner.limiter.on? => false + +Many Thanks! +------------ + +To our [Contributors](https://github.com/ono/resque-cleaner/contributors)