diff options
author | doc <doc@filenotfound.org> | 2025-06-30 20:11:52 +0000 |
---|---|---|
committer | doc <doc@filenotfound.org> | 2025-06-30 20:11:52 +0000 |
commit | 41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 (patch) | |
tree | db7c3520fd91abc3cf56b1a52095d23f3a80d059 /fix_queue.sh |
Diffstat (limited to 'fix_queue.sh')
-rwxr-xr-x | fix_queue.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fix_queue.sh b/fix_queue.sh new file mode 100755 index 0000000..77580b9 --- /dev/null +++ b/fix_queue.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# ===== CONFIG ===== +USERNAME="$1" +RAILS_ENV=production +cd /home/mastodon/live || exit 1 + +if [[ -z "$USERNAME" ]]; then + echo "❌ Usage: $0 <username>" + exit 1 +fi + +echo "🔍 Looking up account ID for @$USERNAME..." +ACCOUNT_ID=$(sudo -u mastodon -H bundle exec rails runner " +acct = Account.find_by(username: '$USERNAME') +puts acct&.id || 'not_found' +") + +if [[ "$ACCOUNT_ID" == "not_found" ]]; then + echo "❌ Account @$USERNAME not found." + exit 1 +fi + +echo "🗑️ Deleting Redis cache for home timeline..." +sudo -u mastodon -H redis-cli DEL feed:home:$ACCOUNT_ID + +echo "🧱 Rebuilding timeline from followed accounts..." +sudo -u mastodon -H bundle exec rails runner " +acct = Account.find_by(username: '$USERNAME') +if acct + FeedInsertWorker.push_bulk(acct.following.pluck(:id)) do |follower_id| + [follower_id, acct.id] + end + puts '✅ Timeline repopulation enqueued.' +end +" + +echo "✅ Done. Home timeline for @$USERNAME reset and rebuilt." |