File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -79,13 +79,17 @@ public function getItems()
7979
8080 public function find ()
8181 {
82+ $ lock = tap ($ this ->stache ->lock ('stache-warming ' ))->acquire (true );
83+
8284 $ this ->stache ->stores ()->flatMap (function ($ store ) {
8385 return $ store instanceof AggregateStore ? $ store ->discoverStores () : [$ store ];
8486 })->each (function ($ store ) {
8587 $ store ->clearCachedPaths ();
8688 $ store ->paths ();
8789 });
8890
91+ $ lock ->release ();
92+
8993 return $ this ;
9094 }
9195
Original file line number Diff line number Diff line change @@ -192,8 +192,13 @@ public function it_finds_all_the_duplicates()
192192 $ store3 = $ this ->mock (AggregateStore::class);
193193 $ store3 ->shouldReceive ('discoverStores ' )->once ()->andReturn ([$ childStore ]);
194194
195+ $ lock = $ this ->mock (\Symfony \Component \Lock \LockInterface::class);
196+ $ lock ->shouldReceive ('acquire ' )->with (true )->once ()->andReturnTrue ();
197+ $ lock ->shouldReceive ('release ' )->once ();
198+
195199 $ stache = $ this ->mock (Stache::class);
196200 $ stache ->shouldReceive ('stores ' )->andReturn (collect ([$ store1 , $ store2 , $ store3 ]));
201+ $ stache ->shouldReceive ('lock ' )->with ('stache-warming ' )->once ()->andReturn ($ lock );
197202
198203 $ duplicates = (new Duplicates ($ stache ));
199204
You can’t perform that action at this time.
0 commit comments