Skip to content

Commit 61f24d3

Browse files
Watson1978kenhys
authored andcommitted
Replace yajl-ruby with the json gem for JSON handling
Since the yajl-ruby gem depends on a deprecated Ruby C API, it cannot be installed with Ruby 4.1. Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
1 parent cf20747 commit 61f24d3

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

lib/fluent/plugin/in_s3.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def run
210210
begin
211211
@poller.poll(options) do |message|
212212
begin
213-
body = Yajl.load(message.body)
213+
body = JSON.parse(message.body)
214214
log.debug(body)
215215
next unless is_valid_queue(body) # skip test queue
216216
if @match_regexp

test/test_in_s3.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def test_one_record
341341
}
342342
]
343343
}
344-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
344+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
345345
@sqs_poller.get_messages(anything, anything) do |config, stats|
346346
config.before_request.call(stats) if config.before_request
347347
stats.request_count += 1
@@ -376,7 +376,7 @@ def test_one_record_with_metadata
376376
}
377377
]
378378
}
379-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
379+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
380380
@sqs_poller.get_messages(anything, anything) do |config, stats|
381381
config.before_request.call(stats) if config.before_request
382382
stats.request_count += 1
@@ -411,7 +411,7 @@ def test_one_record_url_encoded
411411
}
412412
]
413413
}
414-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
414+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
415415
@sqs_poller.get_messages(anything, anything) do |config, stats|
416416
config.before_request.call(stats) if config.before_request
417417
stats.request_count += 1
@@ -446,7 +446,7 @@ def test_one_record_url_encoded_with_metadata
446446
}
447447
]
448448
}
449-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
449+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
450450
@sqs_poller.get_messages(anything, anything) do |config, stats|
451451
config.before_request.call(stats) if config.before_request
452452
stats.request_count += 1
@@ -481,7 +481,7 @@ def test_one_record_multi_line
481481
}
482482
]
483483
}
484-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
484+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
485485
@sqs_poller.get_messages(anything, anything) do |config, stats|
486486
config.before_request.call(stats) if config.before_request
487487
stats.request_count += 1
@@ -521,7 +521,7 @@ def test_one_record_multi_line_with_metadata
521521
}
522522
]
523523
}
524-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
524+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
525525
@sqs_poller.get_messages(anything, anything) do |config, stats|
526526
config.before_request.call(stats) if config.before_request
527527
stats.request_count += 1
@@ -569,7 +569,7 @@ def test_gzip_single_stream
569569
}
570570
]
571571
}
572-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
572+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
573573
@sqs_poller.get_messages(anything, anything) do |config, stats|
574574
config.before_request.call(stats) if config.before_request
575575
stats.request_count += 1
@@ -620,7 +620,7 @@ def test_gzip_multiple_steams
620620
}
621621
]
622622
}
623-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
623+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
624624
@sqs_poller.get_messages(anything, anything) do |config, stats|
625625
config.before_request.call(stats) if config.before_request
626626
stats.request_count += 1
@@ -661,7 +661,7 @@ def test_regexp_matching
661661
}
662662
]
663663
}
664-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
664+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
665665
@sqs_poller.get_messages(anything, anything) do |config, stats|
666666
config.before_request.call(stats) if config.before_request
667667
stats.request_count += 1
@@ -690,7 +690,7 @@ def test_regexp_not_matching
690690
}
691691
]
692692
}
693-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
693+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
694694
@sqs_poller.get_messages(anything, anything) do |config, stats|
695695
config.before_request.call(stats) if config.before_request
696696
stats.request_count += 1
@@ -735,7 +735,7 @@ def test_event_bridge_mode
735735
}
736736
}
737737

738-
message = Struct::StubMessage.new(1, 1, Yajl.dump(body))
738+
message = Struct::StubMessage.new(1, 1, JSON.generate(body))
739739
@sqs_poller.get_messages(anything, anything) do |config, stats|
740740
config.before_request.call(stats) if config.before_request
741741
stats.request_count += 1

0 commit comments

Comments
 (0)