Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ruby/lib/ci/queue/redis.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

gem "redis", "~> 5.0"
require 'redis'
require 'ci/queue/redis/build_record'
require 'ci/queue/redis/base'
Expand Down
8 changes: 4 additions & 4 deletions ruby/lib/ci/queue/redis/build_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def record_error(id, payload, stats: nil)
redis.pipelined do |pipeline|
pipeline.hset(
key('error-reports'),
id.dup.force_encoding(Encoding::BINARY),
payload.dup.force_encoding(Encoding::BINARY),
id,
payload,
)
pipeline.expire(key('error-reports'), config.redis_ttl)
record_stats(stats, pipeline: pipeline)
Expand All @@ -80,8 +80,8 @@ def record_error(id, payload, stats: nil)
def record_success(id, stats: nil, skip_flaky_record: false, acknowledge: true)
@queue.acknowledge(Test.new(id)) if acknowledge
error_reports_deleted_count, requeued_count, _ = redis.pipelined do |pipeline|
pipeline.hdel(key('error-reports'), id.dup.force_encoding(Encoding::BINARY))
pipeline.hget(key('requeues-count'), id.b)
pipeline.hdel(key('error-reports'), id)
pipeline.hget(key('requeues-count'), id)
record_stats(stats, pipeline: pipeline)
end
record_flaky(id) if !skip_flaky_record && (error_reports_deleted_count.to_i > 0 || requeued_count.to_i > 0)
Expand Down
2 changes: 1 addition & 1 deletion ruby/lib/ci/queue/redis/grind_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def record_error(payload, stats: nil)
redis.pipelined do |pipeline|
pipeline.lpush(
key('error-reports'),
payload.force_encoding(Encoding::BINARY),
payload,
)
pipeline.expire(key('error-reports'), config.redis_ttl)
record_stats(stats, pipeline: pipeline)
Expand Down
8 changes: 4 additions & 4 deletions ruby/lib/ci/queue/redis/test_time_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def record_test_time(test_name, duration)
redis.pipelined do |pipeline|
pipeline.lpush(
test_time_key(test_name),
duration.to_s.force_encoding(Encoding::BINARY),
duration.to_s,
)
pipeline.expire(test_time_key(test_name), config.redis_ttl)
end
Expand All @@ -33,7 +33,7 @@ def record_test_name(test_name)
redis.pipelined do |pipeline|
pipeline.lpush(
all_test_names_key,
test_name.dup.force_encoding(Encoding::BINARY),
test_name,
)
pipeline.expire(all_test_names_key, config.redis_ttl)
end
Expand All @@ -53,11 +53,11 @@ def fetch_test_time(test_name)
end

def all_test_names_key
"build:#{config.build_id}:list_of_test_names".dup.force_encoding(Encoding::BINARY)
"build:#{config.build_id}:list_of_test_names"
end

def test_time_key(test_name)
"build:#{config.build_id}:#{test_name}".dup.force_encoding(Encoding::BINARY)
"build:#{config.build_id}:#{test_name}"
end
end
end
Expand Down
Loading