mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: cache setup data before waiting to prevent 409 on retry
When setupAttributes() or setupIndexes() timed out during waitForAllAttributes/waitForAllIndexes, the cache was never populated. Subsequent test methods calling setup again would find empty cache, reuse the same collection IDs (from collection cache), and attempt to re-create existing attributes/indexes, resulting in 409 Conflict errors. Fix: populate the static cache immediately after successful creation (202 assertions), before the wait calls. This ensures retries skip creation and go straight to waiting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3306a03e8e
commit
3b3177722b
1 file changed
+8
-2
@@ -281,11 +281,14 @@ trait DatabasesBase
|
||||
$this->assertEquals(202, $bookTitle['headers']['status-code']);
|
||||
$this->assertEquals(202, $bookDescription['headers']['status-code']);
|
||||
|
||||
// Cache before waiting so that if waitForAllAttributes times out,
|
||||
// subsequent calls don't try to re-create the same attributes (causing 409)
|
||||
self::$attributesCache[$cacheKey] = $data;
|
||||
|
||||
// wait for database worker to create attributes
|
||||
$this->waitForAllAttributes($databaseId, $data['moviesId']);
|
||||
$this->waitForAllAttributes($databaseId, $data['booksId']);
|
||||
|
||||
self::$attributesCache[$cacheKey] = $data;
|
||||
return self::$attributesCache[$cacheKey];
|
||||
}
|
||||
|
||||
@@ -360,10 +363,13 @@ trait DatabasesBase
|
||||
$this->assertEquals(202, $releaseWithDate2['headers']['status-code']);
|
||||
$this->assertEquals(202, $booksFtsIndex['headers']['status-code']);
|
||||
|
||||
// Cache before waiting so that if waitForAllIndexes times out,
|
||||
// subsequent calls don't try to re-create the same indexes (causing 409)
|
||||
self::$indexesCache[$cacheKey] = $data;
|
||||
|
||||
$this->waitForAllIndexes($databaseId, $data['moviesId']);
|
||||
$this->waitForAllIndexes($databaseId, $data['booksId']);
|
||||
|
||||
self::$indexesCache[$cacheKey] = $data;
|
||||
return self::$indexesCache[$cacheKey];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user