From 2b1534d52a62b08f7fb4630cfab27b2d0aa3dcae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20H=C3=B6rberg?= Date: Fri, 8 Sep 2023 13:05:10 +0200 Subject: [PATCH] Don't allocate a buffer to write a string File.write in 1.9.2 allocates a write buffer, which is unessecary --- src/lavinmq/queue/queue.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lavinmq/queue/queue.cr b/src/lavinmq/queue/queue.cr index c157ab496c..7b6fbbd380 100644 --- a/src/lavinmq/queue/queue.cr +++ b/src/lavinmq/queue/queue.cr @@ -137,7 +137,7 @@ module LavinMQ @last_get_time = RoughTime.monotonic @log = Log.for "queue[vhost=#{@vhost.name} name=#{@name}]" @data_dir = make_data_dir - File.write(File.join(@data_dir, ".queue"), @name) + File.open(File.join(@data_dir, ".queue"), "w") { |f| f.sync = true; f.print @name } @state = QueueState::Paused if File.exists?(File.join(@data_dir, ".paused")) @msg_store = init_msg_store(@data_dir) @empty_change = @msg_store.empty_change