about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/lib/request.rb4
-rw-r--r--app/workers/activitypub/delivery_worker.rb10
2 files changed, 10 insertions, 4 deletions
diff --git a/app/lib/request.rb b/app/lib/request.rb
index f2905c462..a08e402ec 100644
--- a/app/lib/request.rb
+++ b/app/lib/request.rb
@@ -52,13 +52,15 @@ class Request
     begin
       response = http_client.public_send(@verb, @url.to_s, @options.merge(headers: headers))
     rescue => e
-      raise e.class, "#{e.message} on #{@url}", e.backtrace
+      raise e.class, "#{e.message} on #{@url}", e.backtrace[0]
     end
 
     begin
       response = response.extend(ClientLimit)
       response.body_with_limit if http_client.persistent?
       yield response if block_given?
+    rescue => e
+      raise e.class, e.message, e.backtrace[0]
     ensure
       http_client.close unless http_client.persistent?
     end
diff --git a/app/workers/activitypub/delivery_worker.rb b/app/workers/activitypub/delivery_worker.rb
index 8524039f9..491a8dd0a 100644
--- a/app/workers/activitypub/delivery_worker.rb
+++ b/app/workers/activitypub/delivery_worker.rb
@@ -50,9 +50,13 @@ class ActivityPub::DeliveryWorker
       end
     end
 
-    light.with_threshold(STOPLIGHT_FAILURE_THRESHOLD)
-         .with_cool_off_time(STOPLIGHT_COOLDOWN)
-         .run
+    begin
+      light.with_threshold(STOPLIGHT_FAILURE_THRESHOLD)
+           .with_cool_off_time(STOPLIGHT_COOLDOWN)
+           .run
+    rescue Stoplight::Error::RedLight => e
+      raise e.class, e.message, e.backtrace.first(3)
+    end
   end
 
   def response_successful?(response)