When a new feed is created in the database, a job to update it in background is scheduled to run hourly. When a feed is destroyed from the database, the job that updates it is unscheduled.

The first run of the job will be a random amount of minutes (between zero and 60) after creating the database, and after that every hour. This means that feed update jobs will be randomly spread over every 1-hour period, to spread server load as evenly as possible. Maybe in the future we can implement a smarter algorithm to determine the optimal time to schedule hourly updates.

Also, the code that stubs some methods (to avoid any HTTP calls or Redis calls during testing) has been moved from individual spec files to the shared spec_helper.rb file. This way such methods are stubbed in all tests, without having to remember to stub them in every spec file.