Skip to content

Commit

Permalink
Benchmark Redis population
Browse files Browse the repository at this point in the history
  • Loading branch information
epistrephein committed Nov 27, 2024
1 parent 1e61757 commit 2d88ae1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tasks/redis.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'redis'
require 'benchmark'

require_relative '../lib/remote'
require_relative '../lib/branch'
Expand All @@ -10,8 +11,10 @@ REDIS ||= Redis.new(url: ENV['REDIS_URL'])

desc 'Fetch remote data and populate Redis'
task :redis do
Branch.build!
Release.build!
benchmark = Benchmark.realtime do
Branch.build!
Release.build!
end

last_update = Time.now

Expand All @@ -36,5 +39,5 @@ task :redis do

REDIS.set('rubies:api:last_update', { last_update: last_update }.to_json)

puts "#{last_update}: Redis OK (#{REDIS.dbsize})"
puts "#{last_update}: Redis OK | #{benchmark.round(2)}s | #{REDIS.dbsize} items"
end

0 comments on commit 2d88ae1

Please sign in to comment.