Skip to main content
The 2024 Developer Survey results are live! See the results

All 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 ...
Ricardo Vila's user avatar
  • 1,646
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 = ...
user2453676's user avatar
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 ...
skrystos's user avatar
  • 107
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 ...
testing09's user avatar
  • 137
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 ...
testing09's user avatar
  • 137
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 ...
Miguel Torres's user avatar
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 ...
arivero's user avatar
  • 935
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 ...
David Krider's user avatar
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 ...
shubham mishra's user avatar
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 ...
Daniel's user avatar
  • 1,814
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 ...
hrdwdmrbl's user avatar
  • 5,139
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 ...
Sam's user avatar
  • 11
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 ...
user1130176's user avatar
  • 1,836
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 ...
lumpidu's user avatar
  • 749
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. ...
Yu Yan's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
29