Try to wait one second for each attribute you're adding.
Creating indexes immediately after creating string attributes often fails
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 2: Process
Hmm okay, I can try that
Rank 2: Process
Actually wait
Rank 2: Process
I might try to add some more elegant error handling
Rank 2: Process
I can try / catch the errors when creating indexes and retry automatically until it completes
Yes, that can work
You can even try and use this
https://appwrite.io/docs/server/databases?sdk=nodejs-default#databasesGetAttribute
To see if you're getting the attribute
Rank 2: Process
Oh nice idea
Rank 2: Process
Yeah
Then maybe something like this.
while(true){ try { await databases.getAttribute('[DATABASE_ID]', '[COLLECTION_ID]', ''); break; } catch (e) { await sleep(1000); }}Rank 2: Process
Right yeah! Thanks 😄
Admin
FYI, at the moment, there are some times throughout the day where these operations can take up to 30 minutes to complete
Rank 2: Process
Oh wow. Is this only the case if there's a lot of data in the collections already?
In my case the collections will always be empty when I'm running this.
Admin
no. there are some database operations that lock up the database 😕 we're working on improving this
Rank 2: Process
Okay, shoot. This limitation would kind of render my creation for the hackathon unusable I'm afraid.
What kind of ETA do you think can be expected on this?
Any chance it's before the hackathon ends? 😂
Admin
This limitation would kind of render my creation for the hackathon unusable I'm afraid.
Do you only have 1 project?
What kind of ETA do you think can be expected on this?
Sorry, I don't have an ETA
Rank 2: Process
Yeah just the one project, it's basically done except for this part I was doing last night.
I do have it working and it was feeling fine with my tests last night, but I'll likely need to think of a different way to handle this knowing of this limitation.
Rank 2: Process
@Steven would I be able to DM you to provide more details that are currently kind of private?
Perhaps you'll see a way of working around the issue
Admin
so the 30 minute delay will only happen once a day...and it's at the same time every day 😬
Admin
asynchronously handling creates with some sort of retry later would be the best approach
Rank 2: Process
@Steven yeah I'm wondering if maybe I can schedule it as a function or something and have some features disabled until the indexes are created
Rank 2: Process
Like on a recurring cron or something
Rank 2: Process
Still not ideal but it'd work in the meantime
Rank 2: Process
Would it be appropriate to provide you with a better context over DM @Steven?
Admin
sure