parallel_minion 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/parallel_minion/minion.rb +12 -9
 - data/lib/parallel_minion/railtie.rb +4 -1
 - data/lib/parallel_minion/version.rb +1 -1
 - data/test/test_db.sqlite3 +0 -0
 - metadata +10 -10
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 015fc75df1c7ac6bef383367673ce73410cc9ce7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 097216df7c146af993520d6625d636c29f78be03
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5e81bfe325e983cc66d0bb723bbcf2306b13f5c31b4fcd56453d4265ec28b226bb27a9653683d3699ff50e59db021b4f3afd95703b0a0074d84c1e1f2b1cdea7
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 953bb13a39536b072874c1cfb22b42eace186d4ffa955605d626f586b946d82d5560896a5e6915f0e07594332770946c78ce87406ac55b1a1ba5cd529f5eeac6
         
     | 
| 
         @@ -113,6 +113,7 @@ module ParallelMinion 
     | 
|
| 
       113 
113 
     | 
    
         | 
| 
       114 
114 
     | 
    
         
             
                  @timeout       = (options.delete(:timeout) || Minion::INFINITE).to_f
         
     | 
| 
       115 
115 
     | 
    
         
             
                  @description   = (options.delete(:description) || 'Minion').to_s
         
     | 
| 
      
 116 
     | 
    
         
            +
                  @metric        = options.delete(:metric)
         
     | 
| 
       116 
117 
     | 
    
         
             
                  @log_exception = options.delete(:log_exception)
         
     | 
| 
       117 
118 
     | 
    
         
             
                  @enabled       = options.delete(:enabled)
         
     | 
| 
       118 
119 
     | 
    
         
             
                  @enabled       = self.class.enabled? if @enabled.nil?
         
     | 
| 
         @@ -128,7 +129,7 @@ module ParallelMinion 
     | 
|
| 
       128 
129 
     | 
    
         
             
                  if @enabled == false
         
     | 
| 
       129 
130 
     | 
    
         
             
                    begin
         
     | 
| 
       130 
131 
     | 
    
         
             
                      logger.info("Started in the current thread: #{@description}")
         
     | 
| 
       131 
     | 
    
         
            -
                      logger.benchmark_info("Completed in the current thread: #{@description}", log_exception: @log_exception) do
         
     | 
| 
      
 132 
     | 
    
         
            +
                      logger.benchmark_info("Completed in the current thread: #{@description}", log_exception: @log_exception, metric: @metric) do
         
     | 
| 
       132 
133 
     | 
    
         
             
                        @result = instance_exec(*args, &block)
         
     | 
| 
       133 
134 
     | 
    
         
             
                      end
         
     | 
| 
       134 
135 
     | 
    
         
             
                    rescue Exception => exc
         
     | 
| 
         @@ -221,13 +222,15 @@ module ParallelMinion 
     | 
|
| 
       221 
222 
     | 
    
         | 
| 
       222 
223 
     | 
    
         
             
                # Returns the current scopes for each of the models for which scopes will be
         
     | 
| 
       223 
224 
     | 
    
         
             
                # copied to the Minions
         
     | 
| 
       224 
     | 
    
         
            -
                if 
     | 
| 
       225 
     | 
    
         
            -
                   
     | 
| 
       226 
     | 
    
         
            -
                     
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
       229 
     | 
    
         
            -
                   
     | 
| 
       230 
     | 
    
         
            -
                     
     | 
| 
      
 225 
     | 
    
         
            +
                if defined?(ActiveRecord)
         
     | 
| 
      
 226 
     | 
    
         
            +
                  if  ActiveRecord::VERSION::MAJOR >= 4
         
     | 
| 
      
 227 
     | 
    
         
            +
                    def self.current_scopes
         
     | 
| 
      
 228 
     | 
    
         
            +
                      @@scoped_classes.collect {|klass| klass.all}
         
     | 
| 
      
 229 
     | 
    
         
            +
                    end
         
     | 
| 
      
 230 
     | 
    
         
            +
                  else
         
     | 
| 
      
 231 
     | 
    
         
            +
                    def self.current_scopes
         
     | 
| 
      
 232 
     | 
    
         
            +
                      @@scoped_classes.collect {|klass| klass.scoped}
         
     | 
| 
      
 233 
     | 
    
         
            +
                    end
         
     | 
| 
       231 
234 
     | 
    
         
             
                  end
         
     | 
| 
       232 
235 
     | 
    
         
             
                end
         
     | 
| 
       233 
236 
     | 
    
         | 
| 
         @@ -242,4 +245,4 @@ module ParallelMinion 
     | 
|
| 
       242 
245 
     | 
    
         
             
                end
         
     | 
| 
       243 
246 
     | 
    
         | 
| 
       244 
247 
     | 
    
         
             
              end
         
     | 
| 
       245 
     | 
    
         
            -
            end
         
     | 
| 
      
 248 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -12,7 +12,10 @@ module ParallelMinion #:nodoc: 
     | 
|
| 
       12 
12 
     | 
    
         
             
                #     config.parallel_minion.enabled = false
         
     | 
| 
       13 
13 
     | 
    
         
             
                #
         
     | 
| 
       14 
14 
     | 
    
         
             
                #     # Add a model so that its current scope is copied to the Minion
         
     | 
| 
       15 
     | 
    
         
            -
                #     config. 
     | 
| 
      
 15 
     | 
    
         
            +
                #     config.after_initialize do
         
     | 
| 
      
 16 
     | 
    
         
            +
                #       # Perform in an after_initialize so that the model has been loaded
         
     | 
| 
      
 17 
     | 
    
         
            +
                #       config.parallel_minion.scoped_classes << MyScopedModel
         
     | 
| 
      
 18 
     | 
    
         
            +
                #     end
         
     | 
| 
       16 
19 
     | 
    
         
             
                #   end
         
     | 
| 
       17 
20 
     | 
    
         
             
                config.parallel_minion = ::ParallelMinion::Minion
         
     | 
| 
       18 
21 
     | 
    
         | 
    
        data/test/test_db.sqlite3
    CHANGED
    
    | 
         Binary file 
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,27 +1,27 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: parallel_minion
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Reid Morrison
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-04-11 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: semantic_logger
         
     | 
| 
       15 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - -  
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
19 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
     | 
    
         
            -
                - -  
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
26 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       27 
27 
     | 
    
         
             
            description: Parallel Minion supports easily handing work off to Minions (Threads)
         
     | 
| 
         @@ -33,13 +33,13 @@ executables: [] 
     | 
|
| 
       33 
33 
     | 
    
         
             
            extensions: []
         
     | 
| 
       34 
34 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       35 
35 
     | 
    
         
             
            files:
         
     | 
| 
      
 36 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 37 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 38 
     | 
    
         
            +
            - lib/parallel_minion.rb
         
     | 
| 
       36 
39 
     | 
    
         
             
            - lib/parallel_minion/horde.rb
         
     | 
| 
       37 
40 
     | 
    
         
             
            - lib/parallel_minion/minion.rb
         
     | 
| 
       38 
41 
     | 
    
         
             
            - lib/parallel_minion/railtie.rb
         
     | 
| 
       39 
42 
     | 
    
         
             
            - lib/parallel_minion/version.rb
         
     | 
| 
       40 
     | 
    
         
            -
            - lib/parallel_minion.rb
         
     | 
| 
       41 
     | 
    
         
            -
            - Rakefile
         
     | 
| 
       42 
     | 
    
         
            -
            - README.md
         
     | 
| 
       43 
43 
     | 
    
         
             
            - test/config/database.yml
         
     | 
| 
       44 
44 
     | 
    
         
             
            - test/minion_scope_test.rb
         
     | 
| 
       45 
45 
     | 
    
         
             
            - test/minion_test.rb
         
     | 
| 
         @@ -54,17 +54,17 @@ require_paths: 
     | 
|
| 
       54 
54 
     | 
    
         
             
            - lib
         
     | 
| 
       55 
55 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       56 
56 
     | 
    
         
             
              requirements:
         
     | 
| 
       57 
     | 
    
         
            -
              - -  
     | 
| 
      
 57 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       58 
58 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       59 
59 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       60 
60 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
              requirements:
         
     | 
| 
       62 
     | 
    
         
            -
              - -  
     | 
| 
      
 62 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       63 
63 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       64 
64 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       65 
65 
     | 
    
         
             
            requirements: []
         
     | 
| 
       66 
66 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       67 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 67 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       68 
68 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       69 
69 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       70 
70 
     | 
    
         
             
            summary: Concurrent processing made easy with Minions (Threads)
         
     |