News for hackers. Stuff that matters.
Re:A Deep Dive into Solid Queue for Ruby on Rails by RangerScience on Monday June 23, 2025 @11:14PM (#44362580)
I think your question is well-asked, and I lament any work environments that have led you to think asking a question like this would be A Problem(tm).

IMO - there’s a lot of things that queues are an excellent answer to. Potentially including performance.

But - queues (generally and among other things) solve the problem of “this will take some time AND the user doesn’t need an immediate response.”

If that’s not your problem, then using queues might not be the solution. If it’s something that’s taking too long and the user DOES need a response, then (as you say) optimizing is what you should try, not queues. Or some product redesign so the user either doesn’t need an immediate response. Or finding a way to split up the part producing an immediate response and the part that takes awhile.

For example: validating uploaded bulk data is in the right “shape”, and then enqueuing the full validation and insertion.

Also really really avoid jobs that enqueue jobs. Sometimes they’re necessary (spacing out some operation on chunks of a group; or a job that ONLY spawns other jobs) but mostly they’re a route to spaghetti.

Re:A Deep Dive into Solid Queue for Ruby on Rails by jaredsohn on Tuesday June 24, 2025 @03:32AM (#44363721)
I made the original post.

At the time there were 5-10 posts (you can look at timestamps if you want to see) and they were all basically assuming that this YC startup misused Rails, etc while I view what they were doing as reasonable, to the extent I can tell.

Basically, if you need to do something that will time out or do something independent of user action, you'll be using enqueued jobs. If you're enqueuing a job because a request is slow and building a db index for it would make it fast, then you're doing things wrong but it isn't clear if that is happening.

Even the multi-region part doesn't seem too complex to me, although I've not had the need for it. I just asked an AI to build me some code for it; you just pass a customer-specific argument into each worker which then enqueues into the proper redis instance or whatever.

I've built jobs that enqueue other jobs and do it for the reasons you mentioned. Sometimes have jobs that do something and then enqueue another job. That happens since that second job might get run in other situations, as well. I don't see that as spaghetti.

Most of the jobs I've built are tracked in some db field to indicate if they were done or not. We'll want those things done and not care too much about when. That seems like a simple concept to me so those code that enqueues it isn't spaghetti in my opinion.