kueda (owner)

Revisions

gist: 113313 Download_button fork
public
Public Clone URL: git://gist.github.com/113313.git
Embed All Files: show embed
notification_worker.rb #
1
2
3
4
5
6
7
8
9
10
11
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
taxon_worker.rb #
1
2
3
4
5
6
7
8
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
 
the error #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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