diff --git a/public/index.php b/public/index.php index 38621f0..d45a970 100644 --- a/public/index.php +++ b/public/index.php @@ -7,14 +7,14 @@ try { $clientPrimaryPreferred = new \MongoDB\Client( - 'mongodb://node0.mongodb.local:27017,node1.mongodb.local:27017,node2.mongodb.local:27017?replicaSet=cluster&connectTimeoutMS=2000&readPreference=primaryPreferred', + 'mongodb://node0.mongodb.local:27017,node1.mongodb.local:27017,node2.mongodb.local:27017?replicaSet=cluster&connectTimeoutMS=2000&readPreference=primaryPreferred&serverSelectionTryOnce=false', [], //force usage of assoc instead of stdClass objects when returning data from mongodb ['typeMap' => ['root' => 'array', 'document' => 'array', 'array' => 'array']] ); $clientSecondaryPreferred = new \MongoDB\Client( - 'mongodb://node0.mongodb.local:27017,node1.mongodb.local:27017,node2.mongodb.local:27017?replicaSet=cluster&connectTimeoutMS=2000&readPreference=secondaryPreferred', + 'mongodb://node0.mongodb.local:27017,node1.mongodb.local:27017,node2.mongodb.local:27017?replicaSet=cluster&connectTimeoutMS=2000&readPreference=secondaryPreferred&serverSelectionTryOnce=false', [], //force usage of assoc instead of stdClass objects when returning data from mongodb ['typeMap' => ['root' => 'array', 'document' => 'array', 'array' => 'array']] diff --git a/start.sh b/start.sh index 8936663..3793220 100755 --- a/start.sh +++ b/start.sh @@ -74,3 +74,15 @@ docker-compose exec mongodb2 sh status.sh query query query + +AFTER_IDLE_TIME=900 + +echo "${GREEN}Starting after test queries every 5s.${RESET}" + +until [ $AFTER_IDLE_TIME -lt 1 ]; do + date + let AFTER_IDLE_TIME-=5 + printf "${AFTER_IDLE_TIME} " + query + sleep 5 +done