reso 0.1.5.3 → 0.1.5.4
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/app/models/import.rb +5 -5
- data/app/models/import_result.rb +6 -0
- data/lib/generators/reso/templates/create_import_results.rb +1 -0
- data/lib/reso/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0158ffcc5ee57dbd9dad799714d6e9243a2a0fd0
         | 
| 4 | 
            +
              data.tar.gz: ad6ff43d4dff5096cb6c8c39c71812e5527a478a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: bf2411a7ecda8969c36cca764e7a00dd2e5d571d7223b4d061cac7568576d239a7a3879c48bd2675ad57c762869c9cd18a2ef802a7c36e820addaf5e2f0c9710
         | 
| 7 | 
            +
              data.tar.gz: d767028deaefd8b65230d4be186bda89324f9c1a7592d3dd73cdaf53bd8a184f2133fbd6dc355a9157eba9f04b5cf323b7da47352b2212390a0fcb16e5df41e9
         | 
    
        data/app/models/import.rb
    CHANGED
    
    | @@ -49,7 +49,7 @@ class Import < ActiveRecord::Base | |
| 49 49 | 
             
                    source_data_modified = self.source_url_last_modified
         | 
| 50 50 | 
             
                    self.update_attribute(:source_data_modified, source_data_modified)
         | 
| 51 51 |  | 
| 52 | 
            -
                     | 
| 52 | 
            +
                    listing_count, count, found_listing_keys, snapshots, stream = 0, 0, [], [], ''
         | 
| 53 53 | 
             
                    open_tag, close_tag = get_open_and_closing_tag_for self.repeating_element
         | 
| 54 54 |  | 
| 55 55 | 
             
                    # Grab a file to work with
         | 
| @@ -68,16 +68,16 @@ class Import < ActiveRecord::Base | |
| 68 68 | 
             
                        doc = Nokogiri::XML([xml_header, xml].join).remove_namespaces!
         | 
| 69 69 | 
             
                        found_listing_keys << create_queued_listing_and_return_listing_key(doc, self)
         | 
| 70 70 | 
             
                        stream.gsub!(xml, '')
         | 
| 71 | 
            -
                        if (( | 
| 71 | 
            +
                        if ((listing_count += 1) % 100).zero?
         | 
| 72 72 | 
             
                          GC.start
         | 
| 73 | 
            -
                          snapshots << [ | 
| 73 | 
            +
                          snapshots << [listing_count, listing_count/(Time.now - start_time)]
         | 
| 74 74 | 
             
                          import_result.update_attribute(:snapshots, snapshots)
         | 
| 75 | 
            -
                          import_result.update_attribute(:found_listing_keys, found_listing_keys)
         | 
| 75 | 
            +
                          import_result.update_attribute(:found_listing_keys, found_listing_keys) unless listing_count > 10000
         | 
| 76 76 | 
             
                          puts snapshots.last.inspect if Rails.env.development?
         | 
| 77 77 | 
             
                        end
         | 
| 78 78 | 
             
                      end
         | 
| 79 79 | 
             
                    end
         | 
| 80 | 
            -
                    snapshots << [ | 
| 80 | 
            +
                    snapshots << [listing_count, listing_count/(Time.now - start_time)]
         | 
| 81 81 | 
             
                    end_time = Time.now
         | 
| 82 82 | 
             
                    self.update_attribute(:status, :active)
         | 
| 83 83 | 
             
                    removed_listing_keys = self.remove_listings_not_present(found_listing_keys)
         | 
    
        data/app/models/import_result.rb
    CHANGED
    
    | @@ -1,6 +1,12 @@ | |
| 1 1 | 
             
            class ImportResult < ActiveRecord::Base
         | 
| 2 2 | 
             
              belongs_to :import
         | 
| 3 | 
            +
              enum status: [ :starting, :running, :finishing, :finished, :stalled, :aborted ]
         | 
| 3 4 | 
             
              serialize :found_listing_keys
         | 
| 4 5 | 
             
              serialize :removed_listing_keys
         | 
| 5 6 | 
             
              serialize :snapshots
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
              def found_count_difference
         | 
| 9 | 
            +
                previous_run = self.import.import_results.where(['start_time < ?', self.start_time]).order("start_time DESC").limit(1).first
         | 
| 10 | 
            +
                previous_run.present? ? self.found_listing_keys.count - previous_run.found_listing_keys.count : nil
         | 
| 11 | 
            +
              end
         | 
| 6 12 | 
             
            end
         | 
| @@ -2,6 +2,7 @@ class CreateImportResults < ActiveRecord::Migration | |
| 2 2 | 
             
              def change
         | 
| 3 3 | 
             
                create_table :import_results do |t|
         | 
| 4 4 | 
             
                  t.references  :import, index: true, foreign_key: true
         | 
| 5 | 
            +
                  t.integer     :status, default: 0
         | 
| 5 6 | 
             
                  t.datetime    :source_data_modified
         | 
| 6 7 | 
             
                  t.datetime    :start_time
         | 
| 7 8 | 
             
                  t.datetime    :end_time
         | 
    
        data/lib/reso/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: reso
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1.5. | 
| 4 | 
            +
              version: 0.1.5.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Michael Edlund
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-09- | 
| 11 | 
            +
            date: 2015-09-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         |