diff --git a/src/lavinmq/amqp/queue/message_store.cr b/src/lavinmq/amqp/queue/message_store.cr index 41fc1fa1b..62c0d28ca 100644 --- a/src/lavinmq/amqp/queue/message_store.cr +++ b/src/lavinmq/amqp/queue/message_store.cr @@ -195,11 +195,17 @@ module LavinMQ def delete close - @segments.each_value { |f| @replicator.try &.delete_file(f.path); f.delete } - @acks.each_value { |f| @replicator.try &.delete_file(f.path); f.delete } + @segments.each_value { |f| delete_file(f) } + @acks.each_value { |f| delete_file(f) } FileUtils.rm_rf @queue_data_dir end + def delete_file(file) + @replicator.try &.delete_file(file.path) + file.delete(raise_on_missing: false) + Fiber.yield + end + def empty? @size.zero? end