I have this server side code (.NET SDK):
//no label is set, but also no exception is thrown
Task<User> updateLabelTask = users.UpdateLabels(studentId, new List<string> { "student" });
Task<Membership> joinStudentsTask = teams.CreateMembership(AppwriteSettings.StudentsTeamId, new List<string>(), null, user.Id);
Task<Membership> joinSchoolTask = teams.CreateMembership(schoolId, new List<string>() {"student"}, null, user.Id);
Task<Membership> joinGroupTask = teams.CreateMembership(group.Id, new List<string>() {"student"}, null, user.Id);
Task<User> verifyTask = users.UpdateEmailVerification(user.Id, true);
await Task.WhenAll(updateLabelTask, joinStudentsTask, joinSchoolTask, joinGroupTask, verifyTask);
This works fine, except for updating the label. If instead I await the updating and only then continue with the other tasks, it works. Why could that happen? Is this an Appwrite issue?
//label is set to "student"
Task<User> updateLabelTask = users.UpdateLabels(studentId, new List<string> { "student" });
await updateLabelTask;
Task<Membership> joinStudentsTask = teams.CreateMembership(AppwriteSettings.StudentsTeamId, new List<string>(), null, user.Id);
Task<Membership> joinSchoolTask = teams.CreateMembership(schoolId, new List<string>() {"student"}, null, user.Id);
Task<Membership> joinGroupTask = teams.CreateMembership(group.Id, new List<string>() {"student"}, null, user.Id);
Task<User> verifyTask = users.UpdateEmailVerification(user.Id, true);
await Task.WhenAll(joinStudentsTask, joinSchoolTask, joinGroupTask, verifyTask);
Update: It only happens most of the time. Sometimes it works.
Recommended threads
- Collection vs Document
I'm confused about the structure of Databases. We have `Database -> Collection -> Document -> Attributes`. This somehow seems to be one layer too much. I want...
- node-appwrite sdk not creating session w...
I am creating a new user with node-appwrite in SSR The docs recommend using AdminClient, but I want to use a regular client (as AdminClient bypasses rate limit...
- Magic URL with Deep Link URI in Flutter ...
I have a Flutter app for Mac with a `myapp://test` custom URI. If I visit that URI in my web browser, it redirects to my app. But when I try to create a magic ...