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