Avatar Edgar Gonzalez

  • Random
  • Archive
  • RSS

Resque :: How to clear old workers from Redis

In a Rails 3 application we’re using resque for background jobs. Because we’re running on heroku, with new deploys sometimes appears “phantom” resque workers in resque-web, this “phantom” workers are old workers that running on a previous EC2 instance that currently is terminated, so the phantom workers really don’t exist but the keys are still in Redis.

The way I clean this phantom workers is:

File: ./lib/resque_ext.rb

module ResqueExt
  #
  # ResqueExt.unregister_workers_for_host("ec210-250-192-51")
  #
  def self.unregister_workers_for_host(host)
    Resque.workers.select{|worker| worker.id.split(':').first==host}.each(&:unregister_worker)
  end
end

BTW the ./config/application.rb file includes the ./lib folder to be autoloadable:

config.autoload_paths += %W(#{config.root}/lib)

Based on this gist

    • #rails3
    • #rails
    • #resque
    • #redis
    • #worker
    • #autoload
  • 1 year ago
  • 20
  • Comments
  • Permalink
  • Share
    Tweet

Consuming the Twitter data: figthing against the hydra

Aníbal and I were invited to talk in the event “Internet Caracas 2010 -  Lets talk about social networks and web business” (Dec 03, 2010)

Our presentation was about our experience doing real time analytics of urls shared in twitter

The way we use NoSQL storages (like MongoDB and Redis) to face this problem. And the several startup iterations, starting with FeedTrace, until InstantPulp, passing through BuzzTrace.

Presentation below:

Consumiendo los datos de Twitter: Luchando contra la Hidra on Prezi

    • #twitter
    • #data
    • #urls shared
    • #firehose
    • #gardenhose
    • #gnip
    • #feedtrace
    • #buzztrace
    • #instantpulp
    • #mongodb
    • #redis
    • #presentation
    • #internet
    • #caracas
  • 2 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Portrait/Logo

About

Edgar Gonzalez

Father, husband, and software developer. I'm building web applications since 1994 for a living and I love it.

Rubyist, Rails developer since 2006, believer of Agile Development and Lean startups, NoSQL enthusiast.

Born in Caracas - Venezuela, living in New York.

Me, Elsewhere

  • @edgar on Twitter
  • Facebook Profile
  • edgargonzaleznetve on Youtube
  • egg on Flickr
  • edgar on Foursquare
  • My Skype Info
  • Linkedin Profile
  • edgar on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr