search for: gen_key

Displaying 5 results from an estimated 5 matches for "gen_key".

2008 Sep 24
1
Clearing cached results
I''m trying to figure out how to clear the for a worker from my controller. In my aysnc_xxx process I set cache[key]. However, I don''t see an easy way to clear the cache from a controller with invoking something on the worker. What I was looking for was something like MiddleMan(:worker_name, :worker_key_name).cache[key]= Is there something like that and I''m just
2006 Jul 03
6
Req: Workers as singletons
...pect if e[1].class.name == klasse return e[0] end end return nil end def new_singleton_worker(opts={}) @mutex.synchronize { worker = get_worker_by_class(opts[:class]) if worker.nil? job_key = opts[:job_key] || gen_key unless self[job_key] self[job_key] = instantiate_worker(opts[:class]).new(opts [:args]) return job_key else raise "job_key: #{job_key} already refers to a running worker" end else return worker...
2007 Mar 02
0
example standalone error ... but if i ...
...w_worker directly...? error: ruby sample_app.rb my sample app :) ./backgroundrb/middleman.rb:440:in `ex'': undefined method `synchronize'' for nil:NilClass (NoMethodError) from ./backgroundrb/middleman.rb:401:in `[]'' from ./backgroundrb/middleman.rb:461:in `gen_key'' from ./backgroundrb/middleman.rb:173:in `new_worker'' from ./backgroundrb/middleman.rb:173:in `new_worker'' from sample_app.rb:9 code: key = MiddleMan.instance.new_worker(:class => :example_worker) -------------- next part -------------- An HTML...
2006 Jun 28
1
How to add some process control...
...eMan::new_worker(), the job is first created, then started. This is because the instance functions I added to BackgrounDrb::Rails don''t seem to be available when kicked off from BackgrounDRb::Rails.initialize() def new_worker(opts={}) @mutex.synchronize { job_key = opts[:job_key] || gen_key unless self[job_key] self[job_key] = instantiate_worker(opts[:class]).new(job_key,opts[:args]) self[job_key].start_process return job_key else raise ::BackgrounDRbDuplicateKeyError end } end In MiddleMan::delete_worker(), I''ve added steps where, if th...
2007 Oct 22
5
How to hook into model attribute changes?
Hi, What''s the best way to hook into any changes made to the value of a single model attribute? I need to know when the encrypted_password attribute on my User model changes i.e. when the user has changed their password. I''m not interested in the actual changed value, I just need to know when it''s been changed so that I can regenerate their API key as well. Thanks in