Replace databasesBatchSize with databasesTransactionSize in database operations

Co-authored-by: jakeb994 <jakeb994@gmail.com>
This commit is contained in:
Cursor Agent
2025-08-14 10:06:43 +00:00
parent 6d477688d7
commit dffe030d16
11 changed files with 11 additions and 10 deletions
+1
View File
@@ -31,6 +31,7 @@ const APP_LIMIT_WRITE_RATE_DEFAULT = 60; // Default maximum write rate per rate
const APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT = 60; // Default maximum write rate period in seconds
const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return in list API calls
const APP_LIMIT_DATABASE_BATCH = 100; // Default maximum batch size for database operations
const APP_LIMIT_DATABASE_TRANSACTION = 100; // Default maximum operations per transaction
const APP_KEY_ACCESS = 24 * 60 * 60; // 24 hours
const APP_USER_ACCESS = 24 * 60 * 60; // 24 hours
const APP_PROJECT_ACCESS = 24 * 60 * 60; // 24 hours
@@ -105,7 +105,7 @@ class Decrement extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + 1) > $maxBatch) {
throw new Exception(
@@ -105,7 +105,7 @@ class Increment extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + 1) > $maxBatch) {
throw new Exception(
@@ -117,7 +117,7 @@ class Delete extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + 1) > $maxBatch) {
throw new Exception(
@@ -129,7 +129,7 @@ class Update extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + 1) > $maxBatch) {
throw new Exception(
@@ -108,7 +108,7 @@ class Upsert extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + \count($documents)) > $maxBatch) {
throw new Exception(
@@ -198,7 +198,7 @@ class Create extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + \count($documents)) > $maxBatch) {
throw new Exception(
@@ -115,7 +115,7 @@ class Delete extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + 1) > $maxBatch) {
throw new Exception(
@@ -139,7 +139,7 @@ class Update extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + 1) > $maxBatch) {
throw new Exception(
@@ -120,7 +120,7 @@ class Upsert extends Action
}
// Enforce max operations per transaction
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + 1) > $maxBatch) {
throw new Exception(
@@ -67,7 +67,7 @@ class AddOperations extends Action
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Invalid or nonpending transaction');
}
$maxBatch = $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH;
$maxBatch = $plan['databasesTransactionSize'] ?? APP_LIMIT_DATABASE_TRANSACTION;
$existing = $transaction->getAttribute('operations', 0);
if (($existing + \count($operations)) > $maxBatch) {