All Questions
Tagged with ruby-on-rails multithreading
421
questions
0
votes
0
answers
32
views
Ruby on Rails, threading in DelayedJob workers
I'm working on a Ruby on Rails web project that runs on Puma server, also has several DelayedJob Workers on different servers.
The project generates some special logs that i want to send to AWS Sqs ...
0
votes
0
answers
40
views
Testing Devise sign_in in a multi-threaded environment
I am using the following code to test multi-threading in a Rails app where users are handled by Devise.
test "multi-threaded sign-in with Devise" do
user1 = create(:user)
user2 = ...
0
votes
1
answer
61
views
Wrapping block of code in ruby Thread object
we need to implement in our gem feature that needs to inject piece of code into Thread.new block statement globally. Let's leave here discussion about why :)
If I define something like:
module ...
6
votes
0
answers
335
views
ActiveRecord- Cannot expire connection
I have the following multithreaded code:
pool.post do
ActiveRecord::Base.connection_pool.with_connection do
process
end
end
where pool is a ThreadPoolExecutor from the concurrent-ruby ...
0
votes
1
answer
295
views
Concurrent Ruby- Thread Pool vs Promises
I currently have some code where I retrieve data from a bunch of URLs. At the moment, I'm doing this sequentially. In order to speed it up, I want to do this concurrently.
To implement this, I'm using ...
1
vote
3
answers
904
views
Close Rails ActiveRecord Connection Pool
I am using a second database with datasets within my API.
Every API request can have up to 3 queries on that Database so I am splitting them in three Threads. To keep it Thread safe I am using a ...
1
vote
2
answers
106
views
How resilient is modern Rails to the antipattern "thread + fork"?
I think this is a popular antipattern that happens either standalone, for example activeJob local task with async, or coming from controllers, because then the strategy of the server must be taken ...
1
vote
1
answer
149
views
How can I keep the Tempfile contents from being empty in a separate (Ruby) thread?
In a Rails 6.x app, I have a controller method which backgrounds queries that take longer than 2 minutes (to avoid a browser timeout), advises the user, stores the results, and sends a link that can ...
2
votes
0
answers
273
views
How Puma helps to run rails app (with Ruby) in multi threading way?
I have read multiple documents and blogs and understood the below points
Ruby is not multithreading since it has the Global Interpreter lock since its interpreter MRI were implemented in C
Unicorn ...
2
votes
1
answer
725
views
Question about thread-safety and disabling multi-threading with Puma
The Puma readme states the following: "Be aware that additionally Puma creates threads on its own for internal purposes (e.g. handling slow clients). So, even if you specify -t 1:1, expect around ...
1
vote
0
answers
651
views
Rails redis cache connection (pool) proper usage in threads
Disclaimer: I really must not be Googling my question properly because this does seem like a basic question.
Basic question: I want to how how to proper use Rails.cache in threads when I do and do not ...
1
vote
0
answers
42
views
How to track symbol created during code loading in Ruby in a thread safe manner
I'd like to track symbol created during code loading in Ruby. I was planning to monkey patch Kernel#require and diff Symbol.all_symbols after and before calling to the built-in #require:
In loaded.rb
...
1
vote
1
answer
334
views
Ruby / Rails Timeout with threads - how to wait a while then rejoin later
I'm trying to run a process in a thread, and if it takes longer than x seconds, redirect to a waiting page and then do an ajax refresh
begin
Timeout::timeout(10) do
t = Thread.new do
...
2
votes
1
answer
372
views
Rails: can I redirect from within a job?
A user starts a POST request to a controller, which causes a longer flow of actions, that are network-bound and typically need 2-3 seconds to finish. After that, the user is redirected to a new page ...
1
vote
1
answer
888
views
Rails hang in Thread
I am trying to make a single-threaded part multi-threaded. The initial single thread code works fine, but after I put it into a thread, the server hangs without any log information in the console.
...