Using Thread.new to send email on rails

I sent letters on my application (ruby 1.8.7, rails 2.3.2) like this Thread.new{UserMailer.deliver_signup_notification(user)}

Since ruby ​​uses green threads, is there any kind of performance advantage, or can I just use UserMailer.deliver_signup_notification(user) ?

thanks

+3
source share
4 answers

Global VM locking will still almost certainly be applied when sending this message, which does not mean any difference.

You should not start threads in a request / response cycle. You should not start topics at all if you cannot observe their creation in order to join, and even then it is rarely worth what it creates.

Rails . , Rails 2.3 , -, environment.rb config.threadsafe!.

. , BackgroundRb .

+2

, . ; , -.

, Rails, , deliver_signup_notification , ( ). , , , .

, , deliver_signup_notification . , .

, Rails- . Rails DRb ( ) . - . Google .

+2

, ( 2.2.2). , ( 20 , , 150 ).

, , , , Google.

- , , .

+2

, .

+1

Source: https://habr.com/ru/post/1705361/


All Articles