Skip to content

Commit a21dcab

Browse files
committed
perf: use URI::DEFAULT_PARSER instead of URI::Parser.new
Signed-off-by: Šimon Lukašík <[email protected]>
1 parent 79220ab commit a21dcab

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/fluent/plugin/buffer/file_single_chunk.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,16 @@ def file_rename(file, old_path, new_path, callback = nil)
238238
callback.call(file) if callback
239239
end
240240

241-
URI_PARSER = URI::Parser.new
242241
ESCAPE_REGEXP = /[^-_.a-zA-Z0-9]/n
243242

244243
def encode_key(metadata)
245244
k = @key ? metadata.variables[@key] : metadata.tag
246245
k ||= ''
247-
URI_PARSER.escape(k, ESCAPE_REGEXP)
246+
URI::DEFAULT_PARSER.escape(k, ESCAPE_REGEXP)
248247
end
249248

250249
def decode_key(key)
251-
URI_PARSER.unescape(key)
250+
URI::DEFAULT_PARSER.unescape(key)
252251
end
253252

254253
def create_new_chunk(path, metadata, perm)

0 commit comments

Comments
 (0)