Add fallback report loading in case websockets fail

This also resolves a race condition scenario. Even if the report gets
rendered via websockets before the controller response is rendered then
the fallback script loads the report again. It's not the most beautiful
but probably okay until we replace websockts altogether.

I'm leaving websockets in at the moment because it can render the report
much quicker than polling can.
This commit is contained in:
Maikel Linke
2024-08-16 14:33:23 +10:00
parent 61f2954973
commit 23aa762be2
4 changed files with 47 additions and 4 deletions

View File

@@ -58,12 +58,12 @@ module Admin
end
def render_in_background
blob = ReportBlob.create_for_upload_later!(report_filename)
@blob = ReportBlob.create_for_upload_later!(report_filename)
ReportJob.perform_later(
report_class:, user: spree_current_user, params:,
format: report_format,
blob:,
blob: @blob,
channel: ScopedChannel.for_id(params[:uuid]),
)
end