kopia lustrzana https://github.com/snarfed/bridgy-fed
temporarily disable actually deleting Followers on AP Delete requests
mastodon.social sends Deletes for every Bridgy Fed account, all at basically the same time, and we have many Follower objects, so we have to do this table scan for each one, so the requests take a long time and end up spawning extra App Engine instances that we get billed for. and the Delete requests are almost never for followers we have. TODO: revisit this and do it right.thib
rodzic
db75c0f555
commit
dba533a14b
|
@ -5,4 +5,5 @@ datastore.dat*
|
|||
/l
|
||||
/local*
|
||||
private_notes
|
||||
service_account_creds.json
|
||||
TAGS
|
||||
|
|
|
@ -18,8 +18,8 @@ Development
|
|||
You'll need Python 3. Install the [Google Cloud SDK](https://cloud.google.com/sdk/gcloud/) (aka `gcloud`) with the `gcloud-appengine-python` and `gcloud-appengine-python-extras` [components](https://cloud.google.com/sdk/docs/components#additional_components). Then, run:
|
||||
|
||||
```sh
|
||||
python3 -m venv local3
|
||||
source local3/bin/activate
|
||||
python3 -m venv local
|
||||
source local/bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
|
|
|
@ -135,12 +135,21 @@ class InboxHandler(common.Handler):
|
|||
return self.undo_follow(self.redirect_unwrap(activity))
|
||||
elif type == 'Delete':
|
||||
id = obj.get('id')
|
||||
if isinstance(id, str):
|
||||
# assume this is an actor
|
||||
# https://github.com/snarfed/bridgy-fed/issues/63
|
||||
for key in Follower.query().iter(keys_only=True):
|
||||
if key.id().split(' ')[-1] == id:
|
||||
key.delete()
|
||||
|
||||
# !!! temporarily disabled actually deleting Followers below because
|
||||
# mastodon.social sends Deletes for every Bridgy Fed account, all at
|
||||
# basically the same time, and we have many Follower objects, so we
|
||||
# have to do this table scan for each one, so the requests take a
|
||||
# long time and end up spawning extra App Engine instances that we
|
||||
# get billed for. and the Delete requests are almost never for
|
||||
# followers we have. TODO: revisit this and do it right.
|
||||
|
||||
# if isinstance(id, str):
|
||||
# # assume this is an actor
|
||||
# # https://github.com/snarfed/bridgy-fed/issues/63
|
||||
# for key in Follower.query().iter(keys_only=True):
|
||||
# if key.id().split(' ')[-1] == id:
|
||||
# key.delete()
|
||||
return
|
||||
|
||||
# fetch actor if necessary so we have name, profile photo, etc
|
||||
|
|
4
app.yaml
4
app.yaml
|
@ -1,7 +1,11 @@
|
|||
# https://cloud.google.com/appengine/docs/standard/python/config/appref
|
||||
|
||||
# application: bridgy-federated
|
||||
|
||||
# pycrypto doesn't support python 3.8 (due to time.clock). should switch to
|
||||
# pycryptodome.
|
||||
runtime: python37
|
||||
|
||||
# default_expiration: 1h
|
||||
|
||||
# https://cloud.google.com/appengine/docs/standard/python3/runtime#entrypoint_best_practices
|
||||
|
|
|
@ -422,4 +422,5 @@ class ActivityPubTest(testutil.TestCase):
|
|||
body=json_dumps(DELETE).encode())
|
||||
self.assertEqual(200, got.status_int)
|
||||
|
||||
self.assertEqual([other], Follower.query().fetch())
|
||||
# TODO: bring back
|
||||
# self.assertEqual([other], Follower.query().fetch())
|
||||
|
|
Ładowanie…
Reference in New Issue