mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: use atomic operations for updating team count
This commit is contained in:
1 parent
ff93957922
commit
5abcb86fd7
2 files changed
+21
-3
No files matched your search
Executable
+19
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
HOSTS=("178.128.204.91 ","164.92.166.207 ","68.183.65.132 ","157.230.18.191 ","68.183.76.206 ","165.227.130.23 ","161.35.212.211 ","64.226.126.100 ","167.172.97.253 ","167.172.102.140 ","167.172.106.74 ","138.68.126.117 ","161.35.192.225 ","138.68.100.209 ","157.245.27.194 ","165.227.156.19 ","67.207.78.138 ","46.101.107.220 ","161.35.70.96 ","167.172.111.219"," 157.230.79.70"," 207.154.241.8 ","165.22.19.119 ","164.90.232.240 ","167.71.33.99 ","64.227.125.178 ","134.122.89.202 ","161.35.18.34 ","206.189.57.113 ","206.189.59.102 ","134.122.74.51 ","165.232.72.163 ","164.90.184.157 ","165.232.72.170 ","165.232.72.165 ","164.90.176.216 ","165.232.72.169 ","167.71.45.112 ","164.90.163.212")
|
||||
|
||||
PUB_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOJpG0jmkAgYLij/BBkTN6HYp4kmH1kicNukcSulEhZV4+R/2ihdTyZgC4OxuHel/5HgWxDQ/E5U2/IgayFtF/68RwGWLdMusaCQbh/JTiYQgCrGW07N+GKFqKgUx2ZNSuPgrHrkXBQOZWGVPieFZ8Z85eGyR+5yNagA093+bgESb/VChuIaa1m3Y7su7f1D8tECR5He8uYKnGmnLKbqcA7riT6xN1a23QdZC1v7j5D8eI1BWPoZ17EP3/DqsQ32qWxkzxU0x5nQhZrhd4Mf4u06mm48ctg/CprMJUzZxG7sZjcmGOg80Vot1oFpw/DCrtjmeIJiYrpT5J1q2kZpOOPafJpi2sogoe5h+ocfQ/QFC5dItihx+fK9e528rKPVZ6j/XTcBg0gGkVvWLRchxg1ZdFSJAkE+c6vcR+N+PxwLoVpe/oL3Yy+h7Gqctor8ac28UWeU2boLlQu+emeFFB+A7FfI+KvvNw3oEvoAuCdVacvCr1KYflwvP0YEIL2osOS27eJwFnrB3zEegL2T5AjqBRtI5HHS8rD/1CfTZV9SymHtp/yFUJCZu93FbWSSr/yLabD/Tor6p3DY6JEs29KQ93oSw2pcTlFo6AWY0/olNTyTcUT7KGI43YuHBKmq6ApQvc9OiLHC01uFo/fIF7qofxqjk9Bz9AaBIZmSk4Bw== shimonewman@gmail.com"
|
||||
|
||||
for HOST in "${HOSTS[@]}"; do
|
||||
echo "Adding key to $HOST"
|
||||
echo "$PUB_KEY" | ssh "root@$HOST" 'cat >> ~/.ssh/authorized_keys'
|
||||
done
|
||||
|
||||
echo "Done."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -967,7 +967,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
|
||||
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
|
||||
$team = Authorization::skip(fn() => $dbForProject->updateDocument('teams', $team->getId(), $team->setAttribute('total', $team->getAttribute('total', 0) + 1)));
|
||||
Authorization::skip(fn() => $dbForProject->increaseDocumentAttribute('teams', $team->getId(), 'total', 1));
|
||||
|
||||
$queueForEvents
|
||||
->setParam('teamId', $team->getId())
|
||||
@@ -1047,8 +1047,7 @@ App::delete('/v1/teams/:teamId/memberships/:membershipId')
|
||||
$dbForProject->deleteCachedDocument('users', $user->getId());
|
||||
|
||||
if ($membership->getAttribute('confirm')) { // Count only confirmed members
|
||||
$team->setAttribute('total', \max($team->getAttribute('total', 0) - 1, 0));
|
||||
Authorization::skip(fn() => $dbForProject->updateDocument('teams', $team->getId(), $team));
|
||||
Authorization::skip(fn() => $dbForProject->decreaseDocumentAttribute('teams', $team->getId(), 'total', 1, 0));
|
||||
}
|
||||
|
||||
$queueForEvents
|
||||
|
||||
Reference in new issue
Block a user