Skip to content

Commit 9247049

Browse files
committed
Adds total time and no longer checks existing wayback links
1 parent ba6b755 commit 9247049

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tools/dev/detect_dead_reference_links.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ def unchecked_urls
7474
def check_url(url_with_path)
7575
url_result = { url: url_with_path[:url], path: url_with_path[:path], status: nil, archived_snapshot: nil }
7676

77+
# Check if the URL is already a Wayback link
78+
if url_with_path[:url].start_with?('http://web.archive.org/web')
79+
url_result[:status] = 'Wayback link (skipped)'
80+
return url_result
81+
end
82+
7783
# Remove "URL-" prefix
7884
cleaned_url = url_with_path[:url].sub(/^URL-/, '')
7985
if !valid_url?(cleaned_url)
@@ -233,6 +239,21 @@ def update_progress
233239

234240
urls_with_paths_final = mapped_data.map { |entry| { url: entry['ref'], path: entry['path'] } }
235241

242+
# Record the start time
243+
start_time = Time.now
244+
245+
# Create and run the UrlChecker
236246
url_checker = UrlChecker.new(urls_with_paths_final, log_level: log_level)
237247
url_checker.check_urls
248+
249+
# Calculate and display the total time taken
250+
end_time = Time.now
251+
elapsed_time = end_time - start_time
252+
253+
# Convert seconds into minutes and seconds
254+
minutes = (elapsed_time / 60).to_i
255+
seconds = (elapsed_time % 60).to_i
256+
257+
# Output the time in minutes and seconds
258+
puts "\nTotal time taken: #{minutes} minutes and #{seconds} seconds"
238259
end

0 commit comments

Comments
 (0)