Don't forget to lycansubscribe

removed fast-track for items whose post already exists

Since we want to be able to track the progress of the import, and we do it by checking the time of the oldest processed (not queued) item, we need to make sure that all items are put into the queue to be processed by PostDownloader in order

Changed files
+6 -15
app
+2 -7
app/models/importable.rb
··· 23 errors.add(:queue, 'must be nil if already processed') if queue && post 24 end 25 26 - def import_item! 27 post_uri = AT_URI(self.post_uri) 28 return nil if !post_uri.is_post? 29 30 - if post = Post.find_by_at_uri(post_uri) 31 - self.post = post 32 - self.post_uri = nil 33 - self.queue = nil 34 - end 35 - 36 self.save! 37 self 38 end
··· 23 errors.add(:queue, 'must be nil if already processed') if queue && post 24 end 25 26 + def import_item!(args = {}) 27 post_uri = AT_URI(self.post_uri) 28 return nil if !post_uri.is_post? 29 30 + self.assign_attributes(args) 31 self.save! 32 self 33 end
+4 -8
app/models/user.rb
··· 23 like = self.new_from_record(like_uri, record) 24 return nil if like.nil? || self.where(rkey: like.rkey).exists? 25 26 - like.assign_attributes(args) 27 - like.import_item! 28 end 29 end 30 ··· 33 repost = self.new_from_record(repost_uri, record) 34 return nil if repost.nil? || self.where(rkey: repost.rkey).exists? 35 36 - repost.assign_attributes(args) 37 - repost.import_item! 38 end 39 end 40 ··· 43 quote = self.new_from_record(post_uri, record) 44 return nil if quote.nil? || self.where(rkey: quote.rkey).exists? 45 46 - quote.assign_attributes(args) 47 - quote.import_item! 48 end 49 end 50 ··· 53 pin = self.new_from_record(post_uri, record) 54 return nil if pin.nil? || self.where(rkey: pin.rkey).exists? 55 56 - pin.assign_attributes(args) 57 - pin.import_item! 58 end 59 end 60
··· 23 like = self.new_from_record(like_uri, record) 24 return nil if like.nil? || self.where(rkey: like.rkey).exists? 25 26 + like.import_item!(args) 27 end 28 end 29 ··· 32 repost = self.new_from_record(repost_uri, record) 33 return nil if repost.nil? || self.where(rkey: repost.rkey).exists? 34 35 + repost.import_item!(args) 36 end 37 end 38 ··· 41 quote = self.new_from_record(post_uri, record) 42 return nil if quote.nil? || self.where(rkey: quote.rkey).exists? 43 44 + quote.import_item!(args) 45 end 46 end 47 ··· 50 pin = self.new_from_record(post_uri, record) 51 return nil if pin.nil? || self.where(rkey: pin.rkey).exists? 52 53 + pin.import_item!(args) 54 end 55 end 56