Skip to content

Instantly share code, notes, and snippets.

@kueda
Created May 18, 2009 04:16
Show Gist options
  • Save kueda/113313 to your computer and use it in GitHub Desktop.
Save kueda/113313 to your computer and use it in GitHub Desktop.
class NotificationWorker < Workling::Base
def deliver_notification(options)
if options[:comment_id]
comment = Comment.find_by_id(options[:comment_id])
Emailer.deliver_comment_notification(comment)
elsif options[:identification_id]
identification = Identification.find_by_id(options[:identification_id])
Emailer.deliver_identification_notification(identification)
end
end
end
class TaxonWorker < Workling::Base
def graft(options)
logger.info("[INFO] Workling is grafting (options: #{options})...")
taxon = Taxon.find_by_id(options[:id])
Ratatosk.graft(taxon)
end
end
trunk > ./script/workling_client run
=> Loading Rails...
** Rails loaded.
** Starting Workling::Remote::Invokers::ThreadedPoller...
** Use CTRL-C to stop.
** Exiting
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log': Mysql::Error: Lock wait timeout exceeded; try restarting transaction: SELECT * FROM `rude_queues` WHERE (`rude_queues`.`processed` = 0 AND `rude_queues`.`queue_name` = 'taxon_workers__graft') ORDER BY id ASC LIMIT 1 FOR UPDATE (ActiveRecord::StatementInvalid)
from /Users/kueda/projects/inaturalist/trunk/vendor/plugins/workling/script/../lib/workling/remote/invokers/threaded_poller.rb:36:in `join'
from /Users/kueda/projects/inaturalist/trunk/vendor/plugins/workling/script/../lib/workling/remote/invokers/threaded_poller.rb:36:in `listen'
from /Users/kueda/projects/inaturalist/trunk/vendor/plugins/workling/script/../lib/workling/remote/invokers/threaded_poller.rb:36:in `each'
from /Users/kueda/projects/inaturalist/trunk/vendor/plugins/workling/script/../lib/workling/remote/invokers/threaded_poller.rb:36:in `listen'
from /Users/kueda/projects/inaturalist/trunk/vendor/plugins/workling/script/listen.rb:24
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:176:in `load'
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:176:in `start_load'
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:257:in `start'
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/controller.rb:72:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:139:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call'
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions'
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:138:in `run'
from ./script/workling_client:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment