Skip to content

Commit

Permalink
Merge branch 'feature/perform-async'
Browse files Browse the repository at this point in the history
* feature/perform-async:
  Allow perform_async by setting delay to 0
  • Loading branch information
averaart committed May 30, 2016
2 parents 3a867c0 + 7269987 commit af9de21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/concerns/wp_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ def classes
def schedule_create_or_update(wp_id, preview = false, request = nil, delay = 0.5)
extra_info = request ? " after #{request.fullpath} -- #{request.body.read}" : ""
Rails.logger.info("SCHEDULED by #{self.class}" + extra_info)
WpApiWorker.perform_in(delay.seconds, self, wp_id, preview)
if delay > 0
WpApiWorker.perform_in(delay.seconds, self, wp_id, preview)
else
WpApiWorker.perform_async(self, wp_id, preview)
end
end

def schedule_update_options
Expand Down

0 comments on commit af9de21

Please sign in to comment.