Class: DynamicLinks::GenerateShortLinksJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- DynamicLinks::GenerateShortLinksJob
- Defined in:
- app/jobs/dynamic_links/generate_short_links_job.rb
Overview
This job generates short links in the background for KGS strategy It is intended to be run periodically We can find available short links by querying the database with query: ShortenedUrl.where(available: true)
To use this strategy, invoke this cli command first: ‘rails generate dynamic_links:add_kgs_migration`
Instance Method Summary collapse
Instance Method Details
#perform(num_links = 100) ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/jobs/dynamic_links/generate_short_links_job.rb', line 13 def perform(num_links = 100) num_links.times do # TODO # Generate a unique short code # Store the short code in the database end end |