diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-10-13 13:30:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-13 13:30:37 +0200 |
commit | 29c31b7ec6ca48ba37b7eb6da650931fd0cb7164 (patch) | |
tree | e4017d3c979604f40e78cdc305f0ab191aedd4b9 /application/bookmark/BookmarkFileService.php | |
parent | 458b6b9918ec27154dd45416947bb93bedb97109 (diff) | |
parent | fd1ddad98df45bc3c18be7980c1cbe68ce6b219c (diff) | |
download | Shaarli-29c31b7ec6ca48ba37b7eb6da650931fd0cb7164.tar.gz Shaarli-29c31b7ec6ca48ba37b7eb6da650931fd0cb7164.tar.zst Shaarli-29c31b7ec6ca48ba37b7eb6da650931fd0cb7164.zip |
Merge pull request #1570 from ArthurHoaro/feature/datastore-mutex
Add mutex on datastore I/O operations
Diffstat (limited to 'application/bookmark/BookmarkFileService.php')
-rw-r--r-- | application/bookmark/BookmarkFileService.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/application/bookmark/BookmarkFileService.php b/application/bookmark/BookmarkFileService.php index c9ec2609..1ba00712 100644 --- a/application/bookmark/BookmarkFileService.php +++ b/application/bookmark/BookmarkFileService.php | |||
@@ -5,6 +5,7 @@ namespace Shaarli\Bookmark; | |||
5 | 5 | ||
6 | 6 | ||
7 | use Exception; | 7 | use Exception; |
8 | use malkusch\lock\mutex\Mutex; | ||
8 | use Shaarli\Bookmark\Exception\BookmarkNotFoundException; | 9 | use Shaarli\Bookmark\Exception\BookmarkNotFoundException; |
9 | use Shaarli\Bookmark\Exception\DatastoreNotInitializedException; | 10 | use Shaarli\Bookmark\Exception\DatastoreNotInitializedException; |
10 | use Shaarli\Bookmark\Exception\EmptyDataStoreException; | 11 | use Shaarli\Bookmark\Exception\EmptyDataStoreException; |
@@ -47,15 +48,19 @@ class BookmarkFileService implements BookmarkServiceInterface | |||
47 | /** @var bool true for logged in users. Default value to retrieve private bookmarks. */ | 48 | /** @var bool true for logged in users. Default value to retrieve private bookmarks. */ |
48 | protected $isLoggedIn; | 49 | protected $isLoggedIn; |
49 | 50 | ||
51 | /** @var Mutex */ | ||
52 | protected $mutex; | ||
53 | |||
50 | /** | 54 | /** |
51 | * @inheritDoc | 55 | * @inheritDoc |
52 | */ | 56 | */ |
53 | public function __construct(ConfigManager $conf, History $history, $isLoggedIn) | 57 | public function __construct(ConfigManager $conf, History $history, Mutex $mutex, $isLoggedIn) |
54 | { | 58 | { |
55 | $this->conf = $conf; | 59 | $this->conf = $conf; |
56 | $this->history = $history; | 60 | $this->history = $history; |
61 | $this->mutex = $mutex; | ||
57 | $this->pageCacheManager = new PageCacheManager($this->conf->get('resource.page_cache'), $isLoggedIn); | 62 | $this->pageCacheManager = new PageCacheManager($this->conf->get('resource.page_cache'), $isLoggedIn); |
58 | $this->bookmarksIO = new BookmarkIO($this->conf); | 63 | $this->bookmarksIO = new BookmarkIO($this->conf, $this->mutex); |
59 | $this->isLoggedIn = $isLoggedIn; | 64 | $this->isLoggedIn = $isLoggedIn; |
60 | 65 | ||
61 | if (!$this->isLoggedIn && $this->conf->get('privacy.hide_public_links', false)) { | 66 | if (!$this->isLoggedIn && $this->conf->get('privacy.hide_public_links', false)) { |