[feature] Clean up/uncache remote media (#407)

* Add whereNotEmptyAndNotNull

* Add GetRemoteOlderThanDays

* Add GetRemoteOlderThanDays

* Add PruneRemote to Manager interface

* Start implementing PruneRemote

* add new attachment + status to tests

* fix up and test GetRemoteOlderThan

* fix bad import

* PruneRemote: return number pruned

* add Cached column to mediaattachment

* update + test pruneRemote

* update mediaTest

* use Cached column

* upstep bun to latest version

* embed structs in mediaAttachment

* migrate mediaAttachment to new format

* don't default cached to true

* select only remote media

* update db dependencies

* step bun back to last working version

* update pruneRemote to use Cached field

* fix storage path of test attachments

* add recache logic to manager

* fix trimmed aspect ratio

* test prune and recache

* return errwithcode

* tidy up different paths for emoji vs attachment

* fix incorrect thumbnail type being stored

* expose TransportController to media processor

* implement tee-ing recached content

* add thoughts of dog to test fedi attachments

* test get remote files

* add comment on PruneRemote

* add postData cleanup to recache

* test thumbnail fetching

* add incredible diagram

* go mod tidy

* buffer pipes for recache streaming

* test for client stops reading after 1kb

* add media-remote-cache-days to config

* add cron package

* wrap logrus so it's available to cron

* start and stop cron jobs gracefully
This commit is contained in:
tobi 2022-03-07 11:08:26 +01:00 committed by GitHub
commit 07727753b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
424 changed files with 637100 additions and 176498 deletions

18
vendor/modernc.org/libc/Makefile generated vendored
View file

@ -25,6 +25,7 @@ all:
go test 2>&1 -timeout 1h | tee -a $(log)
GOOS=darwin GOARCH=amd64 go build
GOOS=darwin GOARCH=arm64 go build
GOOS=freebsd GOARCH=386 go build
GOOS=freebsd GOARCH=amd64 go build
GOOS=linux GOARCH=386 go build
GOOS=linux GOARCH=amd64 go build
@ -32,6 +33,7 @@ all:
GOOS=linux GOARCH=arm64 go build
GOOS=linux GOARCH=s390x go build
GOOS=netbsd GOARCH=amd64 go build
GOOS=openbsd GOARCH=amd64 go build
GOOS=windows GOARCH=386 go build
GOOS=windows GOARCH=amd64 go build
go vet -unsafeptr=false 2>&1 | grep -v $(ngrep) || true
@ -60,6 +62,12 @@ freebsd_amd64:
go generate 2>&1 | tee log-generate
go build -v ./...
# only on freebsd/386
freebsd_386:
@echo "Should be executed only on freebsd/386."
go generate 2>&1 | tee log-generate
go build -v ./...
# only on netbsd/amd64
netbsd_amd64:
@echo "Should be executed only on netbsd/amd64."
@ -87,6 +95,12 @@ linux_s390x:
CCGO_CPP=s390x-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=s390x go generate
GOOS=linux GOARCH=s390x go build -v ./...
# only on openbsd/amd64
openbsd_amd64:
@echo "Should be executed only on openbsd/amd64."
go generate 2>&1 | tee log-generate
go build -v ./...
windows_amd64:
@echo "Should be executed only on windows/amd64."
go generate 2>&1 | tee log-generate
@ -105,6 +119,8 @@ build_all_targets:
GOOS=darwin GOARCH=amd64 go test -c -o /dev/null
GOOS=darwin GOARCH=arm64 go build -v ./...
GOOS=darwin GOARCH=arm64 go test -c -o /dev/null
GOOS=freebsd GOARCH=386 go build -v ./...
GOOS=freebsd GOARCH=386 go test -c -o /dev/null
GOOS=freebsd GOARCH=amd64 go build -v ./...
GOOS=freebsd GOARCH=amd64 go test -c -o /dev/null
GOOS=linux GOARCH=386 go build -v ./...
@ -119,6 +135,8 @@ build_all_targets:
GOOS=linux GOARCH=s390x go test -c -o /dev/null
GOOS=netbsd GOARCH=amd64 go build -v ./...
GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null
GOOS=openbsd GOARCH=amd64 go build -v ./...
GOOS=openbsd GOARCH=amd64 go test -c -o /dev/null
GOOS=windows GOARCH=386 go build -v ./...
GOOS=windows GOARCH=386 go test -c -o /dev/null
GOOS=windows GOARCH=amd64 go build -v ./...