Skip to content

Commit

Permalink
Don't allocate a buffer to write a string
Browse files Browse the repository at this point in the history
File.write in 1.9.2 allocates a write buffer, which is unessecary
  • Loading branch information
carlhoerberg committed Sep 8, 2023
1 parent a3edb44 commit ec55e34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lavinmq/queue/queue.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ec55e34

Please sign in to comment.