Recent Developments on Genius Pool

New Logo!

Genius Pool New Logo

Genius Pool has a swanky new logo courtesy of David Browning of two guys. David does amazing work and has recently worked with thoughtbot on the new Hoptoad notifier. Definitely give them a ring if you’re in need of some design or development.

General Improvements

There’s a new "Job Posted" screen that more accurately reflects some information about how to access jobs from your account once they’re posted and when the job listing expires. An email is now sent out a few days before the job posting expires to remind you to extend your job posting for another 30 days if you choose.

Renewals

This is a long overdue feature but jobs can now be renewed on the site. Renewals are free. If you’d like to have your job read again on any podcasts, that option can be selected at renewal time. This is all accessed from the "My Account" section of the site. Click the gear and hit "Renew" on the dropdown at any time to renew a job. This will place it back on the live site. It looks like this:

Renew Job Listing | Genius Pool.png

Behind The Scenes

Job renewal emails are handled behind the scenes using resque and resque-scheduler for scheduling the tasks. Resque-scheduler is a wonderfully reliable and simple tool for scheduling jobs to be run on a site. It does require resque and redis but if you’re hosting yourself it’s quite easy to set up.

When a job is renewed or activated for the first time (on purchase), two resque jobs are run behind the scenes. One sends out an email with a receipt to the purchaser and one posts the job to twitter. The benefit of putting these items in a background job is that the actions stay out of the request/response cycle which results in a better user experience.

Resque-scheduler runs as its own daemon and it’s configured just like the unix cron utility. The process is to create a config/resque_schedule.yml that has a cron listing of your jobs. The renewal job runs once a day and checks to see if there are any jobs expiring in 3 days. If there are, it sends out a renewal reminder:

class ReminderJob
  @queue = :email
 
  def self.perform
    @jobs = Job.live.where('end_date = ?', 3.days.from_now.to_date)
 
    @jobs.each do |job|
      if job.can_send_renewal_reminder? Date.today
        Notifier.renewal_reminder(job).deliver
        job.update_renewal_reminder!
      end
    end
  end
end

This wouldn’t be complete without some cucumber steps. Jobs are created in the Background step, and the time is set to the appropriate day using Timecop:

  Scenario: A reminder email is sent
    Given the resque schedule queue is loaded
     Then the "email" queue should have 2 queued jobs
     When all jobs are processed
     Then there should be 1 emails with a subject containing "Your job listing is about to expire"


Tags:

No comments yet.

Post your comment