File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1616 )
1717 Aws ::Translate ::Client . stubs ( :new ) . returns ( client )
1818 Discourse . redis . del ( redis_key )
19- posts . each { |post | Discourse . redis . sadd? ( redis_key , post . id ) }
19+ described_class . const_set ( :MAX_QUEUE_SIZE , 100 )
20+ posts . each { |post | Discourse . redis . sadd ( redis_key , post . id ) }
2021 end
2122
2223 it "processes posts in batches and updates their translations" do
3839 post . reload
3940 expect ( post . detected_locale ) . to be_nil
4041 end
41-
4242 expect ( Discourse . redis . smembers ( redis_key ) ) . to match_array ( posts . map ( &:id ) . map ( &:to_s ) )
4343 end
4444
5858 end
5959
6060 it "removes successfully processed posts from Redis" do
61+ posts . each { |post | expect ( Discourse . redis . sismember ( redis_key , post . id ) ) . to be_truthy }
62+
6163 described_class . new . execute ( { } )
6264
6365 posts . each { |post | expect ( Discourse . redis . sismember ( redis_key , post . id ) ) . to be_falsey }
7779
7880 described_class . new . execute ( { } )
7981
80- posts . each do |post |
81- expect ( DistributedMutex ) . to have_received ( :synchronize ) . at_least ( :once )
82- expect ( DistributedMutex ) . to have_received ( :synchronize ) . with ( "detect_translation_#{ post . id } " )
83- end
82+ expect ( DistributedMutex ) . to have_received ( :synchronize ) . at_least ( 5 )
8483 end
8584end
You can’t perform that action at this time.
0 commit comments