Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:05:46+00:00 2026-06-03T06:05:46+00:00

I have delayed_job 3.0.2 installed, and it works with method calls on objects. However,

  • 0

I have delayed_job 3.0.2 installed, and it works with method calls on objects. However, if I call a scope on a class, for example,

Listing.delay.all

then I get error stack level too deep. This happens if I call any scope on any class I have.

Is this error by design? What’s the reason I get stack level too deep error here?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:05:47+00:00Added an answer on June 3, 2026 at 6:05 am

    Using delayed_job properly

    To answer your question indirectly, it looks like you’re not using delayed_job right. I’ll explain what your code does and suggest what you probably are trying to do.

    Listing.delay.all
    

    The method following delay (in this case, all) will get executed in the background. Instead of returning an Array of Listings, it will return a Delayed::Backend::ActiveRecord::Job object. This isn’t what is happening in your case, but I’ll get to that.

    Any job that you background should have a side effect, since the return value of the delayed jobs are not stored. Usually, the side effect is to store something in a database, create a file, or something else that can be detected and used later. By looking at the delayed_job jobs table, you can see that the return value is not stored.

    > Delayed::Backend::ActiveRecord::Job.column_names
     => ["id", "priority", "attempts", "handler", "last_error", "run_at", "locked_at", "failed_at", "locked_by", "queue", "created_at", "updated_at"]
    

    That said, the Listing.all and all the other scope methods do not have any side effects; they only looks up the scoped Listings and return them. When using delayed_job, be sure to use it only on methods that have side effects, such as updating the database, etc.

    Unfortunately, without knowing what you’re trying to accomplish, it’s hard to give advice on how to use delayed_job in your scenario, or even if it’s the right tool for the job.

    Your error message – stack level too deep

    First, I’ll say that getting a stack level too deep error on Listing.delay.all is not normal. I was able to use it on an ActiveRecord model User in my Rails 3 app with delayed_job 3.0.2, and it worked fine. (It didn’t do anything worthwhile, but it returned a Job instead of throwing the error you got.)

    > User.delay.all
     => #<Delayed::Backend::ActiveRecord::Job id: 1, priority: 0, attempts: 0, handler: "--- !ruby/object:Delayed::PerformableMethod\nobject:...", last_error: nil, run_at: "2012-05-02 02:10:39", locked_at: nil, failed_at: nil, locked_by: nil, queue: nil, created_at: "2012-05-02 02:10:39", updated_at: "2012-05-02 02:10:39"> 
    

    Again, there’s not much anyone can do to help you figure out that error without more information. I recommend starting with figuring out if delayed_job is really the right tool for what you’re doing (it’s not if you’re using it to get data to pass to a view), use it properly, and then see if you’re still having the issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some miniapp that use delayed_job. On my localhost everything works fine, but
Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class
I have a rails app using delayed job, it works fine in development. However,
[edit] I can delay all mail using delayed_job plugin on a shared server with
I'm trying to do this with delayed_job and HTTParty : HTTParty.delay.get('http://example.com') It successfully saves
This method works OK, but if I add delayed_job's handle_asychronously, I get can't convert
We have to use delayed_job (or some other background-job processor) to run jobs in
Is there a way to have multiple delayed_job workers updating to the same table?
I'm trying delayed_job now, and have some questions. From the http://github.com/collectiveidea/delayed_job page, I can
Note: Using Rails 3.1 and current delayed_job gem. I have a User model that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.