Browse Source

Explicitly close fedora flysystem connections

pull/852/head
Seth Shaw 4 years ago
parent
commit
de8b16c1b0
  1. 11
      src/Flysystem/Adapter/FedoraAdapter.php

11
src/Flysystem/Adapter/FedoraAdapter.php

@ -50,7 +50,7 @@ class FedoraAdapter implements AdapterInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function has($path) { public function has($path) {
$response = $this->fedora->getResourceHeaders($path); $response = $this->fedora->getResourceHeaders($path, ['Connection' => 'close']);
return $response->getStatusCode() == 200; return $response->getStatusCode() == 200;
} }
@ -77,7 +77,7 @@ class FedoraAdapter implements AdapterInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function readStream($path) { public function readStream($path) {
$response = $this->fedora->getResource($path); $response = $this->fedora->getResource($path, ['Connection' => 'close']);
if ($response->getStatusCode() != 200) { if ($response->getStatusCode() != 200) {
return FALSE; return FALSE;
@ -184,7 +184,10 @@ class FedoraAdapter implements AdapterInterface {
return []; return [];
} }
// Get the resource from Fedora. // Get the resource from Fedora.
$response = $this->fedora->getResource($normalized, ['Accept' => 'application/ld+json']); $response = $this->fedora->getResource($normalized, [
'Accept' => 'application/ld+json',
'Connection' => 'close',
]);
$jsonld = (string) $response->getBody(); $jsonld = (string) $response->getBody();
$graph = json_decode($jsonld, TRUE); $graph = json_decode($jsonld, TRUE);
@ -379,7 +382,7 @@ class FedoraAdapter implements AdapterInterface {
* NULL if no tombstone, TRUE if tombstone deleted, FALSE otherwise. * NULL if no tombstone, TRUE if tombstone deleted, FALSE otherwise.
*/ */
private function deleteTombstone($path) { private function deleteTombstone($path) {
$response = $this->fedora->getResourceHeaders($path); $response = $this->fedora->getResourceHeaders($path, ['Connection' => 'close']);
$return = NULL; $return = NULL;
if ($response->getStatusCode() == 410) { if ($response->getStatusCode() == 410) {
$return = FALSE; $return = FALSE;

Loading…
Cancel
Save