Permalink
Browse files

Will not ignore 404's on deletes anymore.

  • Loading branch information...
treeder committed Feb 12, 2014
1 parent aa3890a commit c3983fa25dc16cd01ae966495e1589e7d3388b40
Showing with 63 additions and 45 deletions.
  1. +18 −17 Gemfile.lock
  2. +2 −0 README.md
  3. +6 −6 lib/iron_mq/alert.rb
  4. +6 −6 lib/iron_mq/messages.rb
  5. +6 −6 lib/iron_mq/queues.rb
  6. +6 −6 lib/iron_mq/subscribers.rb
  7. +1 −1 lib/iron_mq/version.rb
  8. +18 −3 test/test_alerts.rb
View
@@ -9,33 +9,34 @@ GEM
specs:
beanstalk-client (1.1.1)
concur (2.1.1)
- ethon (0.6.1)
+ ethon (0.6.2)
ffi (>= 1.3.0)
mime-types (~> 1.18)
ffi (1.9.3)
go (1.1.0)
concur
- iron_core (1.0.1)
- rest (>= 2.2.0)
- iron_worker_ng (1.0.4)
+ iron_core (1.0.3)
+ rest (>= 2.6.4)
+ iron_worker_ng (1.2.0)
bundler
iron_core (>= 1.0.0)
- rubyzip (= 0.9.9)
+ rubyzip (>= 1.0.0)
mime-types (1.25.1)
- minitest (5.1.0)
- net-http-persistent (2.9)
+ minitest (5.2.3)
+ net-http-persistent (2.9.4)
+ netrc (0.7.7)
quicky (0.4.0)
- rake (10.1.0)
- rest (2.6.3)
- net-http-persistent
- rest-client (>= 0.3.0)
- rest-client (1.6.7)
- mime-types (>= 1.16)
- rubyzip (0.9.9)
+ rake (10.1.1)
+ rest (2.7.1)
+ net-http-persistent (>= 2.9.1)
+ rest_client (>= 1.7.1)
+ rest_client (1.7.2)
+ netrc (~> 0.7.7)
+ rubyzip (1.1.0)
test-unit (2.5.5)
- typhoeus (0.6.6)
- ethon (~> 0.6.1)
- uber_config (1.1.0)
+ typhoeus (0.6.7)
+ ethon (~> 0.6.2)
+ uber_config (1.1.1)
PLATFORMS
ruby
View
@@ -4,6 +4,8 @@ IronMQ Ruby Client
The [full API documentation is here](http://dev.iron.io/mq/reference/api/) and this client tries to stick to the API as
much as possible so if you see an option in the API docs, you can use it in the methods below.
+**WARNING: Version 5+ has some small breaking changes. Version 4 ignored 404's on delete operations, Version
+5 will now raise exceptions.
## Getting Started
View
@@ -36,13 +36,13 @@ def direction
def delete(options = {})
@message.call_api_and_parse_response(:delete, path)
rescue Rest::HttpError => ex
- if ex.code == 404
- IronCore::Logger.info('IronMQ', 'Delete got 404, safe to ignore.')
- # return ResponseBase as normal
- ResponseBase.new({'msg' => 'Deleted'}, 404)
- else
+ #if ex.code == 404
+ # IronCore::Logger.info('IronMQ', 'Delete got 404, safe to ignore.')
+ # # return ResponseBase as normal
+ # ResponseBase.new({'msg' => 'Deleted'}, 404)
+ #else
raise ex
- end
+ #end
end
alias_method :acknowledge, :delete
View
@@ -48,13 +48,13 @@ def subscribers(options = {})
def delete
call_api_and_parse_response(:delete)
rescue Rest::HttpError => ex
- if ex.code == 404
- Rest.logger.info("Delete got 404, safe to ignore.")
- # return ResponseBase as normal
- ResponseBase.new({"msg" => "Deleted"}, 404)
- else
+ #if ex.code == 404
+ # Rest.logger.info("Delete got 404, safe to ignore.")
+ # # return ResponseBase as normal
+ # ResponseBase.new({"msg" => "Deleted"}, 404)
+ #else
raise ex
- end
+ #end
end
def call_api_and_parse_response(meth, ext_path = "", options = {}, instantiate = true)
View
@@ -71,13 +71,13 @@ def delete_queue
@raw = nil
return r
rescue Rest::HttpError => ex
- if ex.code == 404
- Rest.logger.info("Delete got 404, safe to ignore.")
- # return ResponseBase as normal
- ResponseBase.new({"msg" => "Deleted"}, 404)
- else
+ #if ex.code == 404
+ # Rest.logger.info("Delete got 404, safe to ignore.")
+ # # return ResponseBase as normal
+ # ResponseBase.new({"msg" => "Deleted"}, 404)
+ #else
raise ex
- end
+ #end
end
# Backward compatibility
View
@@ -22,13 +22,13 @@ def headers
def delete(options = {})
@message.call_api_and_parse_response(:delete, path)
rescue Rest::HttpError => ex
- if ex.code == 404
- Rest.logger.info("Delete got 404, safe to ignore.")
- # return ResponseBase as normal
- ResponseBase.new({"msg" => "Deleted"}, 404)
- else
+ #if ex.code == 404
+ # Rest.logger.info("Delete got 404, safe to ignore.")
+ # # return ResponseBase as normal
+ # ResponseBase.new({"msg" => "Deleted"}, 404)
+ #else
raise ex
- end
+ #end
end
alias_method :acknowledge, :delete
View
@@ -1,4 +1,4 @@
module IronMQ
- VERSION = "4.0.3"
+ VERSION = "5.0.0"
end
View
@@ -40,7 +40,10 @@ def test_configuration
# wrong delay
alert[:delay] = -13
- assert_raise(Rest::HttpError) { queue.add_alert(alert) }
+ assert_raise(Rest::HttpError) {
+ r = queue.add_alert(alert)
+ p r
+ }
alert[:delay] = '1234'
assert_raise(Rest::HttpError) { queue.add_alert(alert) }
@@ -267,7 +270,19 @@ def delete_messages(queue, n)
end
def delete_queues(*queues)
- queues.each { |q| q.delete_queue }
+ queues.each do |q|
+ begin
+ q.delete_queue
+ rescue Rest::HttpError => ex
+ if ex.code == 404
+ Rest.logger.info("Delete queue got 404, ignoring.")
+ # return ResponseBase as normal
+ return nil
+ else
+ raise ex
+ end
+ end
+ end
end
def trigger_alert(queue, alert_queue, trigger, overhead = 0)
@@ -323,7 +338,7 @@ def clear_queue_add_alert(type, trigger, direction, delay = nil)
assert_equal 1, alerts.size
alert = alerts[0]
- #p alert
+ p alert
assert_equal type, alert.type
assert_equal trigger, alert.trigger
assert_equal alert_qname, alert.queue

0 comments on commit c3983fa

Please sign in to comment.