@@ -4,7 +4,7 @@ if ( ! is_readable(__DIR__ . '/../../vendor/autoload.php')) {
4
4
exit ('skip composer dependencies not available ' );
5
5
}
6
6
7
- $ LIMIT = isset ($ LIMIT ) ? (int )$ LIMIT : 8192 ;
7
+ $ LIMIT = isset ($ LIMIT ) ? (int )$ LIMIT : 1024 ;
8
8
9
9
require_once __DIR__ . '/basic.inc ' ;
10
10
require_once __DIR__ . '/../../vendor/autoload.php ' ;
@@ -55,7 +55,7 @@ $manager = new MongoDB\Driver\Manager(STANDALONE);
55
55
$ bulk = new MongoDB \Driver \BulkWrite ;
56
56
57
57
58
- if (file_exists ($ CACHE ) && filemtime ($ CACHE ) < filemtime (__FILE__ )) {
58
+ if (file_exists ($ CACHE ) && filemtime ($ CACHE ) > filemtime (__FILE__ )) {
59
59
$ data = file_get_contents ($ CACHE );
60
60
$ users = json_decode ($ data , true );
61
61
} else {
@@ -73,14 +73,14 @@ if (file_exists($CACHE) && filemtime($CACHE) < filemtime(__FILE__)) {
73
73
foreach ($ users as $ n => $ user ) {
74
74
$ bulk ->insert ($ user );
75
75
76
- if ($ n >= $ LIMIT ) {
76
+ if ($ n >= $ LIMIT - 1 ) {
77
77
break ;
78
78
}
79
79
}
80
80
$ retval = $ manager ->executeBulkWrite (NS , $ bulk );
81
81
82
- if ($ retval ->getInsertedCount () !== 1024 ) {
83
- exit (sprintf ('skip Fixtures were not loaded (expected: %d, actual: %d) ' , 1024 , $ retval ->getInsertedCount ()));
82
+ if ($ retval ->getInsertedCount () !== $ LIMIT ) {
83
+ exit (sprintf ('skip Fixtures were not loaded (expected: %d, actual: %d) ' , $ LIMIT , $ retval ->getInsertedCount ()));
84
84
}
85
85
86
86
0 commit comments