Skip to content

Commit

Permalink
Fix for reconnecting multi instances in child process when using couc…
Browse files Browse the repository at this point in the history
…hbase version below v4.2.0
  • Loading branch information
srjlewis committed Apr 29, 2024
1 parent b6ca52c commit 8d738e6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/Phpfastcache/Extensions/Drivers/Couchbasev4/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ protected function handleForkedProcess(): void
}

if (static::$prepareToForkPPID) {
if (\version_compare(static::$extVersion, '4.2.0', '<')) {
if (\version_compare(static::$extVersion, '4.2.0', '<') && static::$prepareToForkPPID !== $this->currentParentPID) {
$this->currentParentPID = static::$prepareToForkPPID;
$this->connect(\posix_getppid());
}

if (\version_compare(static::$extVersion, '4.2.1', '>=')) {
Expand All @@ -189,14 +190,8 @@ protected function handleForkedProcess(): void
} else {
Cluster::notifyFork(ForkEvent::CHILD);
}
static::$prepareToForkPPID = 0;
}

static::$prepareToForkPPID = 0;
}

if ($this->currentParentPID) {
$this->connect(\posix_getppid());
$this->currentParentPID = 0;
}
}
}
Expand Down

0 comments on commit 8d738e6

Please sign in to comment.