Ask A Question

Notifications

You’re not receiving notifications from this thread.

Background Jobs

Sascha M. asked in Rails

Hey there,

I'm using nested attributes to generate a bunch of records at once. I'm coding a tool that crawls IP and Website Informations.

The nested attributes are set up like this:

-Company
--has_many: IP-Areas
---has_many: IP-Subnets
----has_many: IP-Addresses
-----has_many: Sites
------has_many: Targets

Each one belongs_to the respective parent. But when it comes to IP-Addresses we're speaking of 1.000.000+ records. You only need to enter the Company name and everything works like a charm. IP-Areas is receiving a ID which identifies a lot of subnets, the subnets are getting iterated over and then I have the IP-Addresses. From there I'm generating a bunch of other records.

So my question:

The form in which you type in the company (and that basically triggers EVERYTHING else, which is pretty cool) takes ages to load because there is so much processing in the background.

I can't find a good tutorial how to actually move everything inside a background job. I'm really stuck there. Do you know a good approach on that or a good ressource that I can look up (not the RoR officials please..).

Thanks a lot,
Sascha

Reply

Hi Sascha,

Check out this tutorial: https://www.sitepoint.com/simple-background-jobs-with-sucker-punch/

That should get you going!

Reply

thx will take a look :)

Reply
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.