you know how long I was going 1 by 1? lmao
Docs should be updated with common "helper" functions IMO, stuff like that isn't that common knowledge, it makes sense, but I feel like most won't think of it
the promise.all part is the:
insert into Appwrite M CVEs at a time
part
though I imagine there's something in the works
yeah that's what I figured
that M is what you would tune
I thought it would be cool to spawn X child functions hahaha
ya...that sounds complicated
Technically it was easy, but yeah the actual implementation with Functions is not
cause it was waiting for the execution to finish before returning resolution, and if I did allSettled then nothing would happen
which makes sense, docker container gets destroyed
stuff like what?
i was doing 150/s...so i think each execution took about 15s to finish
so since it took 15s, i had the function run every minute
neat, smart, that makes sense
Like "tricks" sort of that aren't commonly known, such as inserting large amounts of data using promise.all because I def didn't know for a minute, mostly because I love Python and Dart and such
dart has something like promise.all too 😉
Hey I'm trying to batch delete and I made it dead simple, I'm only giving it 1000 documents at a time for each function creation and every single one is getting internal curl error
Maybe it's too much? Try lowering it?
What's your code?
const batch_size = 1000;
export default async ({ req, res, log, error }: any) => {
const client = new Client()
.setEndpoint('https://appwrite.pva.ai/v1')
.setProject(Bun.env["APPWRITE_FUNCTION_PROJECT_ID"])
.setKey(Bun.env["APPWRITE_API_KEY"]);
const db = new Databases(client);
log("Spawned child function to delete data");
const databaseId = req.body.databaseId;
const collectionId = req.body.collectionId;
const ids = req.body.ids;
const chunkedIds = Array.from({ length: Math.ceil(ids.length / batch_size) }, (_, i) => ids.slice(i * batch_size, (i + 1) * batch_size));
const childPromises: Promise<any>[] = chunkedIds.map(chunk => {
log(`Deleting ${chunk.length} documents`);
return Promise.all(chunk.map(id => db.deleteDocument(databaseId, collectionId, id).catch((e: any) => log(`Error deleting document: ${e}`))));
});
await Promise.all(childPromises);
return res.empty();
};
I'm only seeing 2-3 second runtimes before internal curl
but tbh what I don't understand is what the heck is the internal curl error that's happening? Shouldn't code that works just... work?
Yeah this is still broken
@Steven so is this an Executor error when calling it? I imagine you guys have some idea of what the issue is
Recommended threads
- Dart Runtime as Function is missing
Hey guys, I set the _APP_FUNCTIONS_RUNTIMES to dart-3.10 and redeployed the appwrite stack but unfortunately the dart runtime doesnt show up. I copied the val...
- Go 1.25 runtime
So I'm trying to use go 1.25 for my functions and I can only find go-1.23 as a function runtime. So I did some searching and found https://github.com/appwrite/a...
- Python TablesDB Rework
Hi, i starting to rework some older functions to TablesDB list_rows Method. I used list_documents with a resultset with worked fine. Now i tried to get all rows...