Browse files

Add support for task.on_created callback

Bump patch version
  • Loading branch information...
1 parent a378f23 commit e5cb270ef7e601207d5bb3f8f800f3ceb8eb4928 @catsby catsby committed Feb 16, 2011
Showing with 11 additions and 1 deletion.
  1. +1 −1 VERSION.yml
  2. +9 −0 lib/gearman/task.rb
  3. +1 −0 lib/gearman/taskset.rb
View
2 VERSION.yml
@@ -1,4 +1,4 @@
---
:major: 3
:minor: 0
-:patch: 4
+:patch: 5
View
9 lib/gearman/task.rb
@@ -120,6 +120,15 @@ def handle_completion(data)
@on_complete.call(data) if @on_complete
self
end
+
+ def on_created(&f)
+ @on_created = f
+ end
+
+ def handle_created(data)
+ @on_created.call(data) if @on_created
+ self
+ end
##
# Record a failure and check whether we should be retried.
View
1 lib/gearman/taskset.rb
@@ -102,6 +102,7 @@ def handle_job_created(hostport, data)
else
(@tasks_in_progress[js_handle] ||= []) << task
end
+ task.handle_created(data)
nil
end
private :handle_job_created

0 comments on commit e5cb270

Please sign in to comment.