mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
FIX: tar --list
against a .tar.gz
file takes too long.
This resulted in requests being blocked for an extended amount of time when initializing the restorer.
This commit is contained in:
parent
a04dadf9b4
commit
0bf7519a8a
|
@ -114,18 +114,6 @@ module BackupRestore
|
|||
@meta_filename = File.join(@tmp_directory, BackupRestore::METADATA_FILE)
|
||||
@is_archive = !(@filename =~ /.sql.gz$/)
|
||||
|
||||
# For backwards compatibility
|
||||
@dump_filename =
|
||||
if @is_archive
|
||||
if system('tar', '--list', '--file', @source_filename, BackupRestore::OLD_DUMP_FILE)
|
||||
File.join(@tmp_directory, BackupRestore::OLD_DUMP_FILE)
|
||||
else
|
||||
File.join(@tmp_directory, BackupRestore::DUMP_FILE)
|
||||
end
|
||||
else
|
||||
File.join(@tmp_directory, @filename)
|
||||
end
|
||||
|
||||
@logs = []
|
||||
@readonly_mode_was_enabled = Discourse.readonly_mode?
|
||||
end
|
||||
|
@ -195,7 +183,7 @@ module BackupRestore
|
|||
log "Extracting metadata file..."
|
||||
|
||||
@metadata =
|
||||
if system('tar', '--list', '--file', @source_filename, BackupRestore::METADATA_FILE)
|
||||
if system('tar', '--list', '--file', @tar_filename, BackupRestore::METADATA_FILE)
|
||||
FileUtils.cd(@tmp_directory) do
|
||||
execute_command(
|
||||
'tar', '--extract', '--file', @tar_filename, BackupRestore::METADATA_FILE,
|
||||
|
@ -228,6 +216,18 @@ module BackupRestore
|
|||
end
|
||||
|
||||
def extract_dump
|
||||
@dump_filename =
|
||||
if @is_archive
|
||||
# For backwards compatibility
|
||||
if system('tar', '--list', '--file', @tar_filename, BackupRestore::OLD_DUMP_FILE)
|
||||
File.join(@tmp_directory, BackupRestore::OLD_DUMP_FILE)
|
||||
else
|
||||
File.join(@tmp_directory, BackupRestore::DUMP_FILE)
|
||||
end
|
||||
else
|
||||
File.join(@tmp_directory, @filename)
|
||||
end
|
||||
|
||||
return unless @is_archive
|
||||
|
||||
log "Extracting dump file..."
|
||||
|
|
Loading…
Reference in New Issue
Block a user