Skip to content

Commit

Permalink
Merge pull request #499 from rackspace/working
Browse files Browse the repository at this point in the history
Merging working -> master in preparation for patch release
  • Loading branch information
ycombinator committed Dec 9, 2014
2 parents 6583851 + 5228802 commit 23105f0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/OpenCloud/ObjectStore/Resource/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,15 @@ public function delete($deleteObjects = false)

public function deleteWithObjects($secondsToWait = null)
{
// If timeout (seconds to wait) is not specified by caller, try to
// estimate it based on number of objects in container
// If container is empty, just delete it
$numObjects = (int) $this->retrieveMetadata()->getProperty('Object-Count');
if (0 === $numObjects) {
return $this->delete();
}

// If timeout ($secondsToWait) is not specified by caller,
// try to estimate it based on number of objects in container
if (null === $secondsToWait) {
$numObjects = (int) $this->retrieveMetadata()->getProperty('Object-Count');
$secondsToWait = round($numObjects / 2);
}

Expand All @@ -205,9 +210,11 @@ public function deleteWithObjects($secondsToWait = null)
}
}
}

if (!$containerDeleted) {
throw new ContainerException('Container and all its objects cound not be deleted');
throw new ContainerException('Container and all its objects could not be deleted.');
}

return $response;
}

Expand Down

0 comments on commit 23105f0

Please sign in to comment.