Coder Social home page Coder Social logo

Comments (4)

weifeng365 avatar weifeng365 commented on September 27, 2024

I discover that the channel didn't close after publishing message in queue.rb every time.
So more message sending, more channels opening, you can execute command 'rabbitmqctl list_channels' to see it.
I fix this issue and test 1000k times, it's just OK. The following is patch. I don't know whether such fixing is suitable, if you have the better idea about this please tell me.

----------------------------------------amqp.patch-------------------------------------------------------
diff -uNr ./amqp/lib/mq/queue.rb ./amqp_fix//lib/mq/queue.rb
--- ./amqp/lib/mq/queue.rb 2010-10-15 14:28:09.340387446 +0800
+++ ./amqp_fix//lib/mq/queue.rb 2010-10-15 14:30:25.413032791 +0800
@@ -361,6 +361,7 @@
end

 def publish data, opts = {}
  •  @mq.set_closing true
    
    exchange.publish(data, opts)
    end

@@ -452,4 +453,4 @@
@eXchange ||= Exchange.new(@MQ, :direct, '', :key => name)
end
end
-end
\ No newline at end of file
+end
diff -uNr ./amqp/lib/mq.rb ./amqp_fix//lib/mq.rb
--- ./amqp/lib/mq.rb 2010-10-15 14:28:09.340387446 +0800
+++ ./amqp_fix//lib/mq.rb 2010-10-15 14:29:49.892032825 +0800
@@ -811,6 +811,10 @@

 prefetch(@prefetch_size) if @prefetch_size

end

  • def set_closing closing
  •  @closing = closing
    
  • end

private

@@ -844,4 +848,4 @@
def MQ.id
Thread.current[:mq_id] ||= "#{hostname.strip}-#{Process.pid}-#{Thread.current.object_id}"
end
-end
\ No newline at end of file
+end

from amqp.

tmm1 avatar tmm1 commented on September 27, 2024

This patch does not make sense. MQ and queues are meant to be re-used, you should not be creating a new one every time you want to publish a message.

from amqp.

weifeng365 avatar weifeng365 commented on September 27, 2024

hi tmm1, you're right. The fact is at https://github.com/kennethkalmer/ruote-amqp/issues/#issue/3

from amqp.

botanicus avatar botanicus commented on September 27, 2024

Closed as invalid.

from amqp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.