From 020803aa7e75268d3dbc7413c35ef07b50d5055e Mon Sep 17 00:00:00 2001
From: Christian Berendt <berendt@b1-systems.de>
Date: Mon, 8 Jul 2013 16:06:08 +0200
Subject: [PATCH] minimize waiting time

---
 apps/files_external/lib/amazons3.php   | 4 +++-
 apps/files_external/tests/amazons3.php | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index 756a03b6b54..b55f913e278 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -83,7 +83,9 @@ class AmazonS3 extends \OC\Files\Storage\Common {
 			$result = $this->connection->createBucket(array(
 				'Bucket' => $this->bucket
 			));
-			sleep(5);
+			while ( ! $this->connection->doesBucketExist($this->bucket)) {
+				sleep(1);
+			}
 		}
 
 		if ( ! $this->file_exists('.')) {
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index 15bf9b14772..bd9348bf818 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -59,7 +59,9 @@ class AmazonS3 extends Storage {
 				'Bucket' => $this->config['amazons3']['bucket']
 			));
 
-			sleep(5);
+			while($connection->doesBucketExist($this->config['amazons3']['bucket'])) {
+				sleep(1);
+			}
 		}
 	}
 }
-- 
GitLab