mirror of
https://github.com/discourse/discourse.git
synced 2025-04-02 04:36:01 +08:00
DEV: Add more debugging context to onebox generation
Previously if a onebox timed out we would not present the users in the log with any information regarding the onebox. This makes it very difficult to debug. This adds url/topic/user in the debugging output.
This commit is contained in:
parent
b2481adb40
commit
906ec87d26
@ -21,7 +21,7 @@ class OneboxController < ApplicationController
|
|||||||
|
|
||||||
return render(body: nil, status: 404) if Oneboxer.recently_failed?(url)
|
return render(body: nil, status: 404) if Oneboxer.recently_failed?(url)
|
||||||
|
|
||||||
hijack do
|
hijack(info: "#{url} topic_id: #{topic_id} user_id: #{user_id}") do
|
||||||
Oneboxer.preview_onebox!(user_id)
|
Oneboxer.preview_onebox!(user_id)
|
||||||
|
|
||||||
preview = Oneboxer.preview(url,
|
preview = Oneboxer.preview(url,
|
||||||
|
@ -7,7 +7,7 @@ require 'method_profiler'
|
|||||||
# free up a unicorn worker while the remote IO is happening
|
# free up a unicorn worker while the remote IO is happening
|
||||||
module Hijack
|
module Hijack
|
||||||
|
|
||||||
def hijack(&blk)
|
def hijack(info: nil, &blk)
|
||||||
controller_class = self.class
|
controller_class = self.class
|
||||||
|
|
||||||
if hijack = request.env['rack.hijack']
|
if hijack = request.env['rack.hijack']
|
||||||
@ -31,7 +31,7 @@ module Hijack
|
|||||||
# on the way down the stack
|
# on the way down the stack
|
||||||
original_headers = response.headers.dup
|
original_headers = response.headers.dup
|
||||||
|
|
||||||
Scheduler::Defer.later("hijack #{params["controller"]} #{params["action"]}") do
|
Scheduler::Defer.later("hijack #{params["controller"]} #{params["action"]} #{info}") do
|
||||||
|
|
||||||
MethodProfiler.start(transfer_timings)
|
MethodProfiler.start(transfer_timings)
|
||||||
begin
|
begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user