WebFaction
Community site: login faq

I've been working on a Sinatra app that is running through Passenger.

During startup of the app, I start a few background threads that are supposed to run at all times. I couldn't figure out why they weren't working sometimes so I added a GET '/status' in Sinatra that would print the status of all my threads (which returned 'dead' for all of them).

After some more debugging/googling I found out that Passenger was the one killing my Threads. What is the correct way to run background threads that will never finish within Passenger?

asked 19 Jan '14, 14:33

timvdalen
113
accept rate: 0%


As per the following question, delayed_job might be the way to go.

permanent link

answered 19 Jan '14, 17:01

yulian
27214
accept rate: 24%

Yeah, I noticed that question, but delayed_job's seem to be for jobs, things that actually end sometime. I'll try it though, thanks. Will report back with results.

(19 Jan '14, 17:13) timvdalen

delayed_job was not the answer, it only runs one job at a time and is not meant for non-terminating threads.

I'm going to move the two threads to a separate process and have all communication happen through a database. I'll have to change some push-functionality to polling, but I guess it's the best way.

(20 Jan '14, 11:27) timvdalen

DelayedJob runs in its own thread (or more: you can start as many workers as you want). After a job has run, nothing is stopping to schedule it again :)

(14 Jun '14, 09:11) nathanvda
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×25
×9
×5

question asked: 19 Jan '14, 14:33

question was seen: 5,474 times

last updated: 14 Jun '14, 09:11

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM