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 42ccc6513..d82bbb075 100644
--- a/app/lib/request.rb
+++ b/app/lib/request.rb
@@ -59,7 +59,7 @@ 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
@@ -73,6 +73,8 @@ class Request
       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 5457d9d4b..196af4af1 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 failure_tracker