
I have this server side code (.NET SDK):
TypeScript
//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?
TypeScript
//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);
TL;DR
Developers experiencing concurrency issues when trying to update a label in a .NET SDK code. A workaround is to update the label separately before moving on to other tasks to avoid the issue. This may not be an Appwrite problem.
Update: It only happens most of the time. Sometimes it works.
Recommended threads
- account.get imageUrl
We dont get imageUrl of users when do account.get(), i need to manually fetch,and set it. but this should be default behaviour.
- Internal 500 Server Error
I don't have much information but I am unable to create anything on database, Auth users are creating but not able to fetch into database
- CORS + 401 Error with Appwrite Authentic...
I'm getting a CORS + 401 Error with Appwrite Authentication Access to fetch at 'https://cloud.appwrite.io/v1/account/sessions/email' from origin 'https://my-c...
