Sha256: 16557841000a31eeb00b425cfbe6bcb833f977e510980e72e204eae9912beece
Contents?: true
Size: 1.27 KB
Versions: 4
Compression:
Stored size: 1.27 KB
Contents
#!/usr/bin/env ruby # # file: concurrent_test_wrapped # require 'bundler/setup' require 'skn_utils' # ## # MainLine # ## # begin # CommandJSONPost, CommandFORMGet, CommandJSONGet, # CommandJSONPut, CommandFORMDelete commands = [ SknUtils::CommandJSONGet.call(full_url: "http://jsonplaceholder.typicode.com/posts"), SknUtils::CommandJSONGet.call(full_url: "https://jsonplaceholder.typicode.com/comments"), SknUtils::CommandJSONGet.call(full_url: "https://jsonplaceholder.typicode.com/todos/1"), SknUtils::CommandJSONGet.call(full_url: "http://jsonplaceholder.typicode.com/users") ] # Initialize the queue with Async Workers by default provider = SknUtils::ConcurrentJobs.call # Populate WorkQueue commands.each do |command| provider.register_job do SknUtils::JobWrapper.call(command, SknUtils::HttpProcessor) # mis-spelling these params result in [nil, nil, ...] results end end # Execute WorkQueue result = provider.render_jobs if result.success? puts "Success: true" puts "Values: #{result.values}" puts "Messages: #{result.messages}" else puts "Success: false - errors: #{result.messages.join(', ')}" puts "Values: #{result.values}" end # result.values rescue => e $stderr.puts e.message, e.backtrace end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
skn_utils-5.8.0 | bin/concurrent_test_wrapped |
skn_utils-5.7.0 | bin/concurrent_test_wrapped |
skn_utils-5.6.0 | bin/concurrent_test_wrapped |
skn_utils-5.5.0 | bin/concurrent_test_wrapped |