mastodon.zunda.ninja is one of the many independent Mastodon servers you can use to participate in the fediverse.
Zundon is a single user instance as home of @zundan as well as a test bed for changes of the code.

Administered by:

Server stats:

1
active users

9月下旬からメディアキャッシュをMastodon本体で消すようにしたつもりが消えてないふいんき。要確認わね。

zunda

この起動の時にはvacuum_schedulerは4:08に実行されるように設定されたのかな?うーむ。1日に1度じゃ実行されない可能性も高いな。

2022-10-21T19:31:06.834328+00:00 app web.1 - - pid=68 tid=74g INFO:

Booted Rails 6.1.7 application in production environment
Running in ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
See LICENSE and the LGPL-3.0 for licensing details.
Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org
Loading Schedule
:
Scheduling vacuum_scheduler {"cron"=>"8 4 * * *", "class"=>"Scheduler::VacuumScheduler", "queue"=>"scheduler"}
:
Schedules Loaded

SidekiqSimple, efficient background jobs for RubySidekiq is a simple, efficient framework for background jobs in Ruby

ちゃんと実行されて9秒弱で完了してた。

2022-10-22T04:08:00+00:00 pid=68 tid=6uk4 INFO: queueing Scheduler::VacuumScheduler (vacuum_scheduler)
2022-10-22T04:08:00+00:00 pid=68 tid=3fk2s class=Scheduler::VacuumScheduler jid=87af559ebd5589b76aca09b7 INFO: start
2022-10-22T04:08:09+00:00 pid=68 tid=3fk2s class=Scheduler::VacuumScheduler jid=87af559ebd5589b76aca09b7 elapsed=8.746 INFO: done

しかし消せてないなあw

$ rails c
> ContentRetentionPolicy.current.media_cache_retention_period
=> nil

おやや?content_cache_retention_periodもbackups_retention_periodもnilだわね

(ブラウザの幅を狭くすると/admin/settings/content_retention へのリンクを見つけられなくなる気もする

Postgresにはたぶん期待どおりのデータ(yamlじゃなくて何だろう)が入っている

> SELECT var,value FROM settings WHERE var LIKE '%retention_period';
var | value
--------------------------------+----------
media_cache_retention_period | --- '14'+
|
backups_retention_period | --- '7' +
|
content_cache_retention_period | --- '' +
|
(3 rows)

app/models/content_retention_policy.rbを眺めながらRailsから読んでみる

$ rails c
> Setting.media_cache_retention_period
=> "14"

うん

> Setting.media_cache_retention_period.is_a?(Integer)
=> false

よねえ…

> ContentRetentionPolicy.current.media_cache_retention_period
=> nil
そうなるよなあ…

しかしapp/models/form/admin_settings.rbとかを眺めても*_retention_periodが文字ではなくて整数だっていう記述がないんだよな。

ローカルでバニラ丼を動かしてみて、問題が再現しないならrails-settings-cachedの改造が原因ぽいのでちゃんと読む、問題が再現するならapp/models/form/admin_settings.rbに整数の項目の記述を足す、てな感じでどうじゃろね

よし

> SELECT var,value FROM settings WHERE var LIKE '%retention_period';
var | value
--------------------------------+--------
content_cache_retention_period | --- ''+
|
media_cache_retention_period | --- 14+
|
backups_retention_period | --- 7 +
|
(3 rows)

> ContentRetentionPolicy.current.media_cache_retention_period
=> 14 days