Skip to content

Commit

Permalink
only auto-cleanup jobs if they return '201 Created'
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Oct 5, 2009
1 parent 3c628be commit dd0a06e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/cloud_crowd/models/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ def set_next_status
# completion. The <tt>callback_url</tt> may include HTTP basic authentication,
# if you like:
# http://user:password@example.com/job_complete
# If the callback URL returns a '201 Created' HTTP status code, CloudCrowd
# will assume that the resource has been successfully created, and the Job
# will be cleaned up.
def fire_callback
begin
RestClient.post(callback_url, {:job => self.to_json})
response = RestClient.post(callback_url, {:job => self.to_json})
Thread.new { self.destroy } if response && response.code == 201
rescue RestClient::Exception => e
puts "Failed to fire job callback. Hmmm, what should happen here?"
end
Expand Down
4 changes: 4 additions & 0 deletions wiki/change_log.textile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
h3. Version 0.2.6

* Jobs are now automatically cleaned up only if the callback_url returns a '201 Created' HTTP status code (Previously, any 200-range code would cause a cleanup).

h3. Version 0.2.5

* Bugfix for PostgreSQL databases regarding WorkUnit reservation.
Expand Down

0 comments on commit dd0a06e

Please sign in to comment.