[performance] cache media attachments (#1525)

* replace concurrency worker pools with base models in State.Workers, update code and tests accordingly

* add media attachment caching, slightly tweak default cache config

* further tweak default cache config values

* replace other media attachment db calls to go through cache

* update envparsing test

* fix delete media attachment sql

* fix media sql query

* invalidate cached media entries during status create / update

* fix envparsing test

* fix typo in panic log message...

* add 'updated_at' column during UpdateAttachment

* remove unused func

---------

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2023-03-03 23:02:23 +00:00 committed by GitHub
commit a8e6bdfa33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 235 additions and 61 deletions

View file

@ -239,13 +239,13 @@ cache:
# ttl = cached object lifetime
# sweep-freq = frequency to look for stale cache objects
account-max-size: 100
account-max-size: 500
account-ttl: "5m"
account-sweep-freq: "10s"
account-sweep-freq: "30s"
block-max-size: 100
block-ttl: "5m"
block-sweep-freq: "10s"
block-sweep-freq: "30s"
domain-block-max-size: 1000
domain-block-ttl: "24h"
@ -253,35 +253,39 @@ cache:
emoji-max-size: 500
emoji-ttl: "5m"
emoji-sweep-freq: "10s"
emoji-sweep-freq: "30s"
emoji-category-max-size: 100
emoji-category-ttl: "5m"
emoji-category-sweep-freq: "10s"
emoji-category-sweep-freq: "30s"
media-max-size: 500
media-ttl: "5m"
media-sweep-freq: "30s"
mention-max-size: 500
mention-ttl: "5m"
mention-sweep-freq: "10s"
mention-sweep-freq: "30s"
notification-max-size: 500
notification-ttl: "5m"
notification-sweep-freq: "10s"
notification-sweep-freq: "30s"
report-max-size: 100
report-ttl: "5m"
report-sweep-freq: "10s"
report-sweep-freq: "30s"
status-max-size: 500
status-ttl: "5m"
status-sweep-freq: "10s"
status-sweep-freq: "30s"
tombstone-max-size: 100
tombstone-ttl: "5m"
tombstone-sweep-freq: "10s"
tombstone-sweep-freq: "30s"
user-max-size: 100
user-ttl: "5m"
user-sweep-freq: "10s"
user-sweep-freq: "30s"
######################
##### WEB CONFIG #####