DEV: Improve external upload debugging (#28627)

* Do not delete created external upload stubs for 2 days
  instead of 1 hour if enable_upload_debug_mode is true,
  this aids with server-side debugging.
* If using an API call, return the detailed error message
  if enable_upload_debug_mode is true. In this case the user
  is not using the UI, so a more detailed message is appropriate.
* Add a prefix to log messages in ExternalUploadHelpers, to
  make it easier to find these in logster.
This commit is contained in:
Martin Brennan
2024-08-30 10:25:04 +10:00
committed by GitHub
parent a874ac71bc
commit daa06a1c00
3 changed files with 48 additions and 17 deletions

View File

@@ -404,4 +404,20 @@ RSpec.describe Jobs::CleanUpUploads do
Jobs::CleanUpUploads.new.execute(nil)
expect(ExternalUploadStub.pluck(:id)).to contain_exactly(external_stub1.id, external_stub3.id)
end
it "does not delete create external upload stubs for 2 days if debug mode is on" do
SiteSetting.enable_upload_debug_mode = true
external_stub1 =
Fabricate(
:external_upload_stub,
status: ExternalUploadStub.statuses[:created],
created_at: 2.hours.ago,
)
Jobs::CleanUpUploads.new.execute(nil)
expect(ExternalUploadStub.pluck(:id)).to contain_exactly(external_stub1.id)
SiteSetting.enable_upload_debug_mode = false
Jobs::CleanUpUploads.new.execute(nil)
expect(ExternalUploadStub.pluck(:id)).to be_empty
end
end