maybe if i cache mastodon api instances i can avoid 50% of calls?

im just throwing shit at the wall here im running out of ideas

this could also fuck everything up idk let's see

uhh issue #10
This commit is contained in:
codl 2017-09-21 13:50:24 +02:00
parent a649d21549
commit 7967cc686c
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
2 changed files with 3 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from app import db, sentry
from math import inf
import iso8601
from libforget.exceptions import TemporaryError
from functools import lru_cache
def get_or_create_app(instance_url, callback, website):
@ -68,6 +69,7 @@ def receive_code(code, app, callback):
return token
@lru_cache()
def get_api_for_acc(account):
app = MastodonApp.query.get(account.mastodon_instance)
for token in account.tokens:

View File

@ -92,7 +92,7 @@ def test_brotli_dynamic_cache(br_client):
def test_brotli_dynamic_timeout(app):
from secrets import token_urlsafe
libforget.brotli.brotli(app, timeout=0.01)
libforget.brotli.brotli(app, timeout=0)
@app.route('/hard_to_compress')
def hard_to_compress():