Questions tagged [ruby-thread]
13 questions
2
votes
1 answer
Rails threads limit in production
I am working on uber like/cab booking app. I am using Action Cable for this purpose. After creation of new order server get list of 10 nearest drivers and send each in turn order details (with a pause of 40 seconds).
Thread.new do
…

ViT-Vetal-
- 2,431
- 3
- 19
- 35
2
votes
1 answer
How to use gdb to get ruby backtrace from different thread
I have a ruby program that spawns two threads. Rarely, it appears to be hanging on the main thread, and I'm trying to use gdb to figure out why.
Using the blog post here, I have used gdb to attach to to the process, and call rb_backtrace() to get…

davidgyoung
- 63,876
- 14
- 121
- 204
1
vote
1 answer
Ruby threads not working after upgrading to Rails 5
I have an API which uses a Service, in which I have used Ruby thread to reduce the response time of the API. I have tried to share the context using the following example. It was working fine with Rails 4, ruby 2.2.1
Now, we have upgraded rails to…

mukesh4139
- 76
- 9
1
vote
2 answers
Is it possible to use IO.pipe for inter-thread communication in Ruby?
In the Ruby IO.pipe example from the documentation, a single message is passed through the processes.
I wanted to do something similar, with two differences:
use threads instead of processes
use a pipe for ongoing messaging, not for a once-off…

Marcus
- 5,104
- 2
- 28
- 24
0
votes
0 answers
Rspec tests failing for Ruby Thread
I have a worker method which looks like this
class ScoreWorker
include Sidekiq::Worker
sidekiq_options queue: 'score_worker'
def perform(scores, notification, devices)
threads = []
scores.each do |gg|
threads << Thread.new {…

Kingsley Simon
- 2,090
- 5
- 38
- 84
0
votes
0 answers
How can I change the string to the Thread class in ruby on rails
Let's understand the scenario, I have to call a third party API in one of the API calls to my server (let say A) from the mobile app. That third party API takes almost 12-15 seconds to execute. However, in the next consecutive API call to my server…

Hamza Shamshad
- 69
- 1
- 5
0
votes
0 answers
Fiber local use case
I am not sure if I am doing this right, but here is my scenario:
I need to create a thread to do some API call and continue with normal operations while the API call is made. This part is fine. The issue arises when I want to join back in.
I am…

Jaleel Ahmed
- 65
- 8
0
votes
1 answer
Ruby class within a module needs to access containing class namespace
I have written a small application in Ruby and now want to add a simple API to it to allow other applications to run some basic queries against it.
I've been looking at senatra, as it seems very lightweight and simple. But I suspect that rather than…

Kaliklipper
- 355
- 5
- 19
0
votes
1 answer
Git Hook - Ruby Code - Interactive Input
I am trying to take input from git hook execution code(commit-msg hook). But the ruby is not able to stop at the input point. And its executing the code as if input is like a puts statement. Here is the code I tried and failed.
#!/usr/bin/env…

SV Madhava Reddy
- 1,858
- 2
- 15
- 33
0
votes
1 answer
handle AVL messages with iodine
Right now I'm developing a some sort of parser for the messages of the Skypatrol TT8750+ and my threaded TCP server is working. The problem is that it isn't a good approach if there are to many devices connected at the same time. I'm using iodine…
0
votes
1 answer
How to run REST-call simultanously or with a lower priority
I am loading data via a REST call and rendering it. After that, I am calling another REST API which takes about 10 seconds. In this time, I can't make another REST call until this one is finished. My question is, how can I do this?
I tried with a…

driphekitr
- 3
- 3
0
votes
2 answers
Ruby threading/forking with API (Sinatra)
I am using Sinatra gem for my API. What I want to do is when request is received process it, return the response and start new long running task.
I am newbie to Ruby, I have read about Threading but not sure what is the best way to accomplish my…
user4470093
0
votes
0 answers
Why ruby kills running threads?
As per thread documentations; when a Ruby program terminates, all running threads are killed, regardless of their states. Why does not ruby waits for all spawned threads to terminate first?

Vijay Shanker Dubey
- 4,308
- 6
- 32
- 49