Module: ODDB::Util::Job

Defined in:
src/util/job.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) run(opts = {}, &block)



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'src/util/job.rb', line 9

def Job.run opts={}, &block
  system = DRb::DRbObject.new(nil, ODDB.config.server_url)
  DRb.start_service
  begin
    ODBA.cache.setup
    ODBA.cache.clean_prefetched
    DRb.install_id_conv ODBA::DRbIdConv.new
    system.peer_cache ODBA.cache unless opts[:readonly] rescue Errno::ECONNREFUSED
    block.call ODDB::App.new(:auxiliary => true)
  ensure
    system.unpeer_cache ODBA.cache unless opts[:readonly]
  end
end