Skip to content

Commit

Permalink
Fix Surfline pulls for subregions containing multiple surfline regions
Browse files Browse the repository at this point in the history
  • Loading branch information
swrobel committed Jan 15, 2018
1 parent b32f115 commit 181f6f9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/tasks/surfline.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ namespace :surfline do
SurflineNearshore
SurflineLola
Subregion.all.each do |subregion|
num_spots = subregion.spots.size
get_all_spots = num_spots > 1
get_all_spots = subregion.spots.size > 1
spot = subregion.spots.first
pool.post { SurflineNearshore.api_pull(spot, get_all_spots) }
pool.post { SurflineLola.api_pull(spot, get_all_spots) }

# These subregions contain two surfline regions, so we need to do two separate requests for them
next unless ['los-angeles', 'santa-barbara-ventura'].include? subregion.slug
spot = subregion.spots.last
pool.post { SurflineNearshore.api_pull(spot, get_all_spots) }
pool.post { SurflineLola.api_pull(spot, get_all_spots) }
spot2 = subregion.spots.last
pool.post { SurflineNearshore.api_pull(spot2, get_all_spots) }
pool.post { SurflineLola.api_pull(spot2, get_all_spots) }
end

pool.shutdown
Expand Down

0 comments on commit 181f6f9

Please sign in to comment.